Diegovch18 commited on
Commit
d9a5323
verified
1 Parent(s): 3365814

nuevas entradas y salidas

Browse files
Files changed (1) hide show
  1. app.py +8 -5
app.py CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
2
  import speech_recognition as sr
3
 
4
  # Funci贸n para convertir audio en texto
5
- def audio_to_text(audio):
6
  recognizer = sr.Recognizer()
7
  with sr.AudioFile(audio) as source:
8
  audio_data = recognizer.record(source)
@@ -13,15 +13,18 @@ def audio_to_text(audio):
13
  text = "No se pudo entender el audio."
14
  except sr.RequestError:
15
  text = "No se pudo conectar al servicio de reconocimiento."
16
- return text
17
-
 
 
18
  respuesta = gr.Textbox(label="Transcripci贸n")
 
19
 
20
  # Interfaz de Gradio
21
  interface = gr.Interface(
22
  fn=audio_to_text,
23
- inputs=gr.Audio(sources=['upload', 'microphone'], type="filepath"),
24
- outputs=respuesta,
25
  title="Conversi贸n de Audio a Texto",
26
  description="Convierte audio capturado por el micr贸fono en texto utilizando reconocimiento de voz.",
27
  live=True
 
2
  import speech_recognition as sr
3
 
4
  # Funci贸n para convertir audio en texto
5
+ def audio_to_text(audio, titulo):
6
  recognizer = sr.Recognizer()
7
  with sr.AudioFile(audio) as source:
8
  audio_data = recognizer.record(source)
 
13
  text = "No se pudo entender el audio."
14
  except sr.RequestError:
15
  text = "No se pudo conectar al servicio de reconocimiento."
16
+ return text, titulo.upper()
17
+
18
+ titulo=gr.Textbox(label="T铆tulo del audio")
19
+ audio=gr.Audio(sources=['upload', 'microphone'], type="filepath")
20
  respuesta = gr.Textbox(label="Transcripci贸n")
21
+ otro_mensaje = gr.Textbox(label="Este es otro valor de salida")
22
 
23
  # Interfaz de Gradio
24
  interface = gr.Interface(
25
  fn=audio_to_text,
26
+ inputs=[audio, titulo],
27
+ outputs=[respuesta, otro_mensaje],
28
  title="Conversi贸n de Audio a Texto",
29
  description="Convierte audio capturado por el micr贸fono en texto utilizando reconocimiento de voz.",
30
  live=True