Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ from transformers import WhisperProcessor, WhisperForConditionalGeneration, pipe
|
|
13 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
14 |
|
15 |
# load model and processor
|
16 |
-
model_id = "rbcurzon/whisper-small-
|
17 |
pipe = pipeline("automatic-speech-recognition",
|
18 |
model=model_id,
|
19 |
chunk_length_s=30,
|
@@ -72,13 +72,16 @@ async def test(
|
|
72 |
raise Exception("The speech is difficult to understand.")
|
73 |
|
74 |
translatedResult = translate(result['text'], srcLang=srcLang, tgtLang=tgtLang)
|
75 |
-
|
76 |
-
|
77 |
"transcribed_text": result['text'],
|
78 |
"translated_text": translatedResult,
|
79 |
"srcLang": srcLang,
|
80 |
"tgtLang": tgtLang
|
81 |
-
}
|
|
|
|
|
|
|
82 |
|
83 |
except Exception as error:
|
84 |
print("Error: ", str(error))
|
|
|
13 |
device = "cuda:0" if torch.cuda.is_available() else "cpu"
|
14 |
|
15 |
# load model and processor
|
16 |
+
model_id = "rbcurzon/whisper-small-tgl"
|
17 |
pipe = pipeline("automatic-speech-recognition",
|
18 |
model=model_id,
|
19 |
chunk_length_s=30,
|
|
|
72 |
raise Exception("The speech is difficult to understand.")
|
73 |
|
74 |
translatedResult = translate(result['text'], srcLang=srcLang, tgtLang=tgtLang)
|
75 |
+
|
76 |
+
result_dict = {
|
77 |
"transcribed_text": result['text'],
|
78 |
"translated_text": translatedResult,
|
79 |
"srcLang": srcLang,
|
80 |
"tgtLang": tgtLang
|
81 |
+
}
|
82 |
+
print(result_dict)
|
83 |
+
|
84 |
+
return result_dict
|
85 |
|
86 |
except Exception as error:
|
87 |
print("Error: ", str(error))
|