Charlie Amalet
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -14,8 +14,7 @@ LOCAL_DIR.mkdir(exist_ok=True)
|
|
14 |
SAVE_DIR = LOCAL_DIR / "transcripts"
|
15 |
SAVE_DIR.mkdir(exist_ok=True)
|
16 |
LANGS = [lang.capitalize() for lang in list(LANGUAGES.values())]
|
17 |
-
|
18 |
-
DEVICE = 'cuda'
|
19 |
loaded_model = whisper.load_model("medium", DEVICE)
|
20 |
current_size = "None"
|
21 |
|
@@ -34,6 +33,7 @@ def get_transcript(audio_path, task_selection:str, language:str, max_line_width=
|
|
34 |
"max_line_width": max_line_width if max_line_width > 0 else None,
|
35 |
"max_line_count": max_line_count if max_line_count > 0 else None,
|
36 |
"max_words_per_line": max_words_per_line if max_words_per_line > 0 else None
|
|
|
37 |
}
|
38 |
|
39 |
options = dict(task=task_selection.lower(), best_of=5, language=TO_LANGUAGE_CODE[language.lower()])
|
|
|
14 |
SAVE_DIR = LOCAL_DIR / "transcripts"
|
15 |
SAVE_DIR.mkdir(exist_ok=True)
|
16 |
LANGS = [lang.capitalize() for lang in list(LANGUAGES.values())]
|
17 |
+
DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
18 |
loaded_model = whisper.load_model("medium", DEVICE)
|
19 |
current_size = "None"
|
20 |
|
|
|
33 |
"max_line_width": max_line_width if max_line_width > 0 else None,
|
34 |
"max_line_count": max_line_count if max_line_count > 0 else None,
|
35 |
"max_words_per_line": max_words_per_line if max_words_per_line > 0 else None
|
36 |
+
|
37 |
}
|
38 |
|
39 |
options = dict(task=task_selection.lower(), best_of=5, language=TO_LANGUAGE_CODE[language.lower()])
|