Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -35,7 +35,8 @@ def format_and_group_timestamps(chunks, interval=5.0):
|
|
35 |
def transcribe_audio(input_file, language, chunk_length_s=10, stride_length_s=(4, 2), return_timestamps="word"):
|
36 |
target_lang_options = {"English": "eng", "Luganda": "lug", "Acholi": "ach", "Runyankole": "nyn", "Lugbara": "lgg"}
|
37 |
target_lang_code = target_lang_options[language]
|
38 |
-
|
|
|
39 |
if target_lang_code == "eng":
|
40 |
# Use Whisper for English
|
41 |
model = whisper.load_model("small")
|
@@ -44,7 +45,6 @@ def transcribe_audio(input_file, language, chunk_length_s=10, stride_length_s=(4
|
|
44 |
return result["text"]
|
45 |
else:
|
46 |
# Use specified model for other languages
|
47 |
-
device = "cuda" if torch.cuda.is_available() else "cpu"
|
48 |
model_id = "Sunbird/sunbird-mms"
|
49 |
|
50 |
auth_token = os.environ.get("HF_TOKEN")
|
|
|
35 |
def transcribe_audio(input_file, language, chunk_length_s=10, stride_length_s=(4, 2), return_timestamps="word"):
|
36 |
target_lang_options = {"English": "eng", "Luganda": "lug", "Acholi": "ach", "Runyankole": "nyn", "Lugbara": "lgg"}
|
37 |
target_lang_code = target_lang_options[language]
|
38 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
39 |
+
|
40 |
if target_lang_code == "eng":
|
41 |
# Use Whisper for English
|
42 |
model = whisper.load_model("small")
|
|
|
45 |
return result["text"]
|
46 |
else:
|
47 |
# Use specified model for other languages
|
|
|
48 |
model_id = "Sunbird/sunbird-mms"
|
49 |
|
50 |
auth_token = os.environ.get("HF_TOKEN")
|