Skip to content

Commit e477d76

Browse files
committed
Improve user home detection and update Whisper model
Replaced os.getlogin() with USERPROFILE environment variable for more reliable user home directory detection. Updated default Whisper model from 'medium' to 'large-v3' in transcribe_podcast for improved transcription quality.
1 parent 7fe1634 commit e477d76

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

scripts/transcribe_wav.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ def upgrade_pip_and_install_whisper():
88
"""
99
Aggiorna pip e installa o reinstalla correttamente whisper.
1010
"""
11-
user_name = os.getlogin()
12-
python_path = os.path.join(f"C:\\Users\\{user_name}\\AppData\\Local\\Programs\\Python\\Python310", "python.exe")
11+
user_home = os.environ.get('USERPROFILE')
12+
python_path = os.path.join(user_home, "AppData", "Local", "Programs", "Python", "Python310", "python.exe")
1313

1414
if not os.path.exists(python_path):
1515
print(f"Errore: Python 3.10 non trovato in {python_path}.")
@@ -43,11 +43,11 @@ def ensure_python_3_10():
4343
if sys.version_info[0] != 3 or sys.version_info[1] != 10:
4444
print("Forzando l'esecuzione con Python 3.10...")
4545

46-
# Recupera il nome dell'utente corrente
47-
user_name = os.getlogin()
46+
# Recupera il percorso della home directory reale
47+
user_home = os.environ.get('USERPROFILE')
4848

4949
# Costruisci il percorso di Python 3.10 dinamicamente
50-
python_path = os.path.join(f"C:\\Users\\{user_name}\\AppData\\Local\\Programs\\Python\\Python310", "python.exe")
50+
python_path = os.path.join(user_home, "AppData", "Local", "Programs", "Python", "Python310", "python.exe")
5151

5252
if not os.path.exists(python_path):
5353
print(f"Errore: Python 3.10 non trovato in {python_path}. Verifica che Python 3.10 sia installato correttamente.")
@@ -82,7 +82,7 @@ def import_whisper():
8282
print(f"Impossibile importare whisper anche dopo l'installazione: {e}")
8383
sys.exit(1)
8484

85-
def transcribe_podcast(file_path, model_name='medium', language='it'):
85+
def transcribe_podcast(file_path, model_name='large-v3', language='it'):
8686
"""
8787
Trascrive un file audio in formato .wav utilizzando il modello Whisper.
8888
"""

0 commit comments

Comments
 (0)