Irpan commited on
Commit
ef107e3
·
1 Parent(s): 70da837
Files changed (2) hide show
  1. app.py +1 -1
  2. asr.py +11 -7
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
- Transcribes audio to text using the Whisper model for Uyghur.
45
- Args:
46
- - audio_data: Gradio audio input
47
- Returns:
48
- - str: The transcription of the audio.
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>>"