Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -21,19 +21,6 @@ def recognize_speech(audio_data):
|
|
21 |
audio = recognizer.record(source)
|
22 |
|
23 |
audio_text = recognizer.recognize_google(audio, language="es-ES")
|
24 |
-
st.subheader("Texto Reconocido:")
|
25 |
-
st.write(audio_text)
|
26 |
-
|
27 |
-
except sr.UnknownValueError:
|
28 |
-
st.warning("No se pudo reconocer el audio. ¿Intentaste grabar algo?")
|
29 |
-
audio_text = ""
|
30 |
-
|
31 |
-
except sr.RequestError as e:
|
32 |
-
st.error(f"Error en el reconocimiento de voz: {e}")
|
33 |
-
audio_text = ""
|
34 |
-
|
35 |
-
st.success("Reconocimiento de voz completado.")
|
36 |
-
return audio_text
|
37 |
|
38 |
def format_prompt(message, history):
|
39 |
prompt = "<s>"
|
@@ -85,10 +72,9 @@ def main():
|
|
85 |
st.session_state.history = []
|
86 |
|
87 |
if not audio_data.empty():
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
audio_data.export("audio.wav", format="wav")
|
92 |
|
93 |
audio_text = recognize_speech("audio.wav")
|
94 |
|
|
|
21 |
audio = recognizer.record(source)
|
22 |
|
23 |
audio_text = recognizer.recognize_google(audio, language="es-ES")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def format_prompt(message, history):
|
26 |
prompt = "<s>"
|
|
|
72 |
st.session_state.history = []
|
73 |
|
74 |
if not audio_data.empty():
|
75 |
+
st.audio(audio_data.export().read(), format="audio/wav")
|
76 |
+
audio_data.export("audio.wav", format="wav")
|
77 |
+
st.write(f"Frame rate: {audio_data.frame_rate}, Frame width: {audio_data.frame_width}, Duration: {audio_data.duration_seconds} seconds")
|
|
|
78 |
|
79 |
audio_text = recognize_speech("audio.wav")
|
80 |
|