qanastek commited on
Commit
535f2ec
β€’
1 Parent(s): cef12c2
app.py CHANGED
@@ -10,7 +10,7 @@ SAMPLE_RATE = 16_000
10
 
11
  models = {}
12
 
13
- models_names = {
14
  "en-US": "jonatasgrosman/wav2vec2-large-xlsr-53-english",
15
  "fr-FR": "jonatasgrosman/wav2vec2-large-xlsr-53-french",
16
  "nl-NL": "jonatasgrosman/wav2vec2-large-xlsr-53-dutch",
@@ -56,8 +56,8 @@ def transcribe(audio_path, lang_code):
56
 
57
  if lang_code not in models:
58
  models[lang_code] = {}
59
- models[lang_code]["processor"] = Wav2Vec2Processor.from_pretrained(models_names[lang_code])
60
- models[lang_code]["model"] = Wav2Vec2ForCTC.from_pretrained(models_names[lang_code])
61
 
62
  # Load model
63
  processor_asr = models[lang_code]["processor"]
@@ -114,7 +114,7 @@ iface = gr.Interface(
114
  description='Upload your wav file to test the models',
115
  inputs=[
116
  gr.inputs.Audio(label='wav file', source='microphone', type='filepath'),
117
- gr.inputs.Dropdown(choices=list(models_names.keys())),
118
  ],
119
  outputs=[
120
  gr.outputs.JSON(label='Slot Recognition + Intent Classification + Language Classification + ASR'),
 
10
 
11
  models = {}
12
 
13
+ models_paths = {
14
  "en-US": "jonatasgrosman/wav2vec2-large-xlsr-53-english",
15
  "fr-FR": "jonatasgrosman/wav2vec2-large-xlsr-53-french",
16
  "nl-NL": "jonatasgrosman/wav2vec2-large-xlsr-53-dutch",
 
56
 
57
  if lang_code not in models:
58
  models[lang_code] = {}
59
+ models[lang_code]["processor"] = Wav2Vec2Processor.from_pretrained(models_paths[lang_code])
60
+ models[lang_code]["model"] = Wav2Vec2ForCTC.from_pretrained(models_paths[lang_code])
61
 
62
  # Load model
63
  processor_asr = models[lang_code]["processor"]
 
114
  description='Upload your wav file to test the models',
115
  inputs=[
116
  gr.inputs.Audio(label='wav file', source='microphone', type='filepath'),
117
+ gr.inputs.Dropdown(choices=list(models_paths.keys())),
118
  ],
119
  outputs=[
120
  gr.outputs.JSON(label='Slot Recognition + Intent Classification + Language Classification + ASR'),
wavs/{en_US=order-me-a-pizza.wav β†’ en-US=order-me-a-pizza.wav} RENAMED
File without changes
wavs/{en_US=set-the-volume-to-low.wav β†’ en-US=set-the-volume-to-low.wav} RENAMED
File without changes
wavs/{en_US=tell-me-a-good-joke.wav β†’ en-US=tell-me-a-good-joke.wav} RENAMED
File without changes
wavs/{en_US=tell-me-the-artist-of-this-song.wav β†’ en-US=tell-me-the-artist-of-this-song.wav} RENAMED
File without changes
wavs/{es_ES=poner-una-alarma-a-las-doce.wav β†’ es-ES=poner-una-alarma-a-las-doce.wav} RENAMED
File without changes