Spaces:
Running
Running
Irpan
commited on
Commit
·
ef107e3
1
Parent(s):
70da837
asr
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ mms_transcribe = gr.Interface(
|
|
8 |
inputs=[
|
9 |
gr.Audio(),
|
10 |
gr.Dropdown(
|
11 |
-
choices=[model for model in asr.models_info],
|
12 |
label="Select Model for ASR",
|
13 |
value="ixxan/wav2vec2-large-mms-1b-uyghur-latin",
|
14 |
interactive=True
|
|
|
8 |
inputs=[
|
9 |
gr.Audio(),
|
10 |
gr.Dropdown(
|
11 |
+
choices=[model for model in asr.models_info] + ["Compare All Models"],
|
12 |
label="Select Model for ASR",
|
13 |
value="ixxan/wav2vec2-large-mms-1b-uyghur-latin",
|
14 |
interactive=True
|
asr.py
CHANGED
@@ -40,14 +40,18 @@ models_info = {
|
|
40 |
}
|
41 |
|
42 |
def transcribe(audio_data, model_id) -> str:
|
43 |
-
""
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
50 |
|
|
|
51 |
# Load audio file
|
52 |
if not audio_data:
|
53 |
return "<<ERROR: Empty Audio Input>>"
|
|
|
40 |
}
|
41 |
|
42 |
def transcribe(audio_data, model_id) -> str:
|
43 |
+
if model_id == "Compare All Models":
|
44 |
+
return transcribe_all_models(audio_data)
|
45 |
+
else:
|
46 |
+
return transcribe_with_model(audio_data, model_id)
|
47 |
+
|
48 |
+
def transcribe_all_models(audio_data) -> dict:
|
49 |
+
transcriptions = {}
|
50 |
+
for model_id in models_info.keys():
|
51 |
+
transcriptions[model_id] = transcribe_with_model(audio_data, model_id)
|
52 |
+
return transcriptions
|
53 |
|
54 |
+
def transcribe_with_model(audio_data, model_id) -> str:
|
55 |
# Load audio file
|
56 |
if not audio_data:
|
57 |
return "<<ERROR: Empty Audio Input>>"
|