not-lain commited on
Commit
1ffa7d4
1 Parent(s): c540f1a

audio to text

Browse files
Files changed (1) hide show
  1. app.py +5 -6
app.py CHANGED
@@ -19,7 +19,7 @@ seamless_client = Client("facebook/seamless_m4t")
19
 
20
 
21
 
22
- def process_speech(audio_input,input_language,target_language):
23
  """
24
  processing sound using seamless_m4t
25
  """
@@ -42,7 +42,7 @@ def process_speech(audio_input,input_language,target_language):
42
  audio_input, #audio_name
43
  "",
44
  input_language,# source language
45
- target_language,# target language
46
  api_name="/run",
47
  )
48
  out = out[1] # get the text
@@ -419,16 +419,15 @@ with gr.Blocks(theme='ParityError/Anime') as iface :
419
  image_input = gr.Image(label="upload image")
420
  image_output = gr.Markdown(label="output text")
421
  image_button = gr.Button("process image")
422
- with gr.Tab("speech to text translation"):
423
  with gr.Row():
424
- input_language = gr.Dropdown(languages, label="input language",value="French",interactive=True)
425
- target_language = gr.Dropdown(languages, label="target language",value="English",interactive=True)
426
  audio_input = gr.Audio(label="speak",type="filepath",sources="microphone")
427
  audio_output = gr.Markdown(label="output text")
428
  audio_button = gr.Button("process audio")
429
  text_button.click(process_and_query, inputs=text_input, outputs=text_output)
430
  image_button.click(process_image, inputs=image_input, outputs=image_output)
431
- audio_button.click(process_speech, inputs=[audio_input,input_language,target_language], outputs=audio_output)
432
 
433
 
434
  iface.queue().launch(show_error=True,debug=True)
 
19
 
20
 
21
 
22
+ def process_speech(audio_input,input_language):
23
  """
24
  processing sound using seamless_m4t
25
  """
 
42
  audio_input, #audio_name
43
  "",
44
  input_language,# source language
45
+ input_language,# target language
46
  api_name="/run",
47
  )
48
  out = out[1] # get the text
 
419
  image_input = gr.Image(label="upload image")
420
  image_output = gr.Markdown(label="output text")
421
  image_button = gr.Button("process image")
422
+ with gr.Tab("speech to text"):
423
  with gr.Row():
424
+ input_language = gr.Dropdown(languages, label="select the language",value="French",interactive=True)
 
425
  audio_input = gr.Audio(label="speak",type="filepath",sources="microphone")
426
  audio_output = gr.Markdown(label="output text")
427
  audio_button = gr.Button("process audio")
428
  text_button.click(process_and_query, inputs=text_input, outputs=text_output)
429
  image_button.click(process_image, inputs=image_input, outputs=image_output)
430
+ audio_button.click(process_speech, inputs=[audio_input,input_language], outputs=audio_output)
431
 
432
 
433
  iface.queue().launch(show_error=True,debug=True)