lucio commited on
Commit
9cf16b3
1 Parent(s): 3792e2d

don't try to show expected result

Browse files
Files changed (1) hide show
  1. app.py +8 -10
app.py CHANGED
@@ -170,12 +170,12 @@ def client(audio_data: np.array, sample_rate: int, default_lang: str):
170
  return f"{text_lab}: {result}"
171
 
172
 
173
- def stt(default_lang: str, audio: Tuple[int, np.array], state=None):
174
  sample_rate, audio = audio
175
 
176
  recognized_result = client(audio, sample_rate, default_lang)
177
 
178
- return recognized_result, state
179
 
180
 
181
  def _convert_audio(audio_data: np.array, sample_rate: int):
@@ -200,21 +200,19 @@ iface = gr.Interface(
200
  inputs=[
201
  gr.inputs.Radio(choices=("chatino", "mixteco", "totonaco"), default="mixteco", label=UI_STRINGS["labels"]["target"][ui_language]),
202
  gr.inputs.Audio(type="numpy", label=UI_STRINGS["labels"]["input"][ui_language], source="microphone", optional=False),
203
- gr.inputs.State(label="Resultado esperado")
204
  ],
205
  outputs=[
206
  gr.outputs.Textbox(label=UI_STRINGS["labels"]["output"][ui_language]),
207
- gr.outputs.State(label="Resultado esperado")
208
  ],
209
  title=UI_STRINGS["title"][ui_language],
210
  theme="huggingface",
211
  description=UI_STRINGS["description"][ui_language],
212
- examples=[["mixteco", "ejemplos/espanol1-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav", "español: "],
213
- ["mixteco", "ejemplos/espanol2-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav", "español: "],
214
- ["mixteco", "ejemplos/mixteco1-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav", "mixteco: "],
215
- ["mixteco", "ejemplos/mixteco2-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav", "mixteco: "],
216
- ["totonaco", "ejemplos/totonaco1-Zongo_Botan_Acanthaceae-Justicia-spicigera_SLC388-IPN389_2018-07-26-i.wav", "totonaco: "],
217
- ["totonaco", "ejemplos/totonaco2-Zongo_Botan_Acanthaceae-Justicia-spicigera_SLC388-IPN389_2018-07-26-i.wav", "totonaco: "]],
218
  article=UI_STRINGS["title"][ui_language],
219
  )
220
 
 
170
  return f"{text_lab}: {result}"
171
 
172
 
173
+ def stt(default_lang: str, audio: Tuple[int, np.array]):
174
  sample_rate, audio = audio
175
 
176
  recognized_result = client(audio, sample_rate, default_lang)
177
 
178
+ return recognized_result
179
 
180
 
181
  def _convert_audio(audio_data: np.array, sample_rate: int):
 
200
  inputs=[
201
  gr.inputs.Radio(choices=("chatino", "mixteco", "totonaco"), default="mixteco", label=UI_STRINGS["labels"]["target"][ui_language]),
202
  gr.inputs.Audio(type="numpy", label=UI_STRINGS["labels"]["input"][ui_language], source="microphone", optional=False),
 
203
  ],
204
  outputs=[
205
  gr.outputs.Textbox(label=UI_STRINGS["labels"]["output"][ui_language]),
 
206
  ],
207
  title=UI_STRINGS["title"][ui_language],
208
  theme="huggingface",
209
  description=UI_STRINGS["description"][ui_language],
210
+ examples=[["mixteco", "ejemplos/espanol1-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav"],
211
+ ["mixteco", "ejemplos/espanol2-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav"],
212
+ ["mixteco", "ejemplos/mixteco1-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav"],
213
+ ["mixteco", "ejemplos/mixteco2-Yolox_BotFl_CTB501-FEF537-EGS503_40202-Acanthaceae-Ruellia_2017-01-05-h.wav"],
214
+ ["totonaco", "ejemplos/totonaco1-Zongo_Botan_Acanthaceae-Justicia-spicigera_SLC388-IPN389_2018-07-26-i.wav"],
215
+ ["totonaco", "ejemplos/totonaco2-Zongo_Botan_Acanthaceae-Justicia-spicigera_SLC388-IPN389_2018-07-26-i.wav"]],
216
  article=UI_STRINGS["title"][ui_language],
217
  )
218