Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from gtts import gTTS
|
|
6 |
from audiorecorder import audiorecorder
|
7 |
import speech_recognition as sr
|
8 |
|
9 |
-
pre_prompt_text = "
|
10 |
|
11 |
if "history" not in st.session_state:
|
12 |
st.session_state.history = []
|
@@ -24,14 +24,14 @@ def recognize_speech(audio_data, show_messages=True):
|
|
24 |
try:
|
25 |
audio_text = recognizer.recognize_google(audio, language="es-ES")
|
26 |
if show_messages:
|
27 |
-
st.subheader("
|
28 |
st.write(audio_text)
|
29 |
-
st.success("
|
30 |
except sr.UnknownValueError:
|
31 |
-
st.warning("
|
32 |
audio_text = ""
|
33 |
except sr.RequestError:
|
34 |
-
st.error("
|
35 |
audio_text = ""
|
36 |
|
37 |
return audio_text
|
@@ -84,7 +84,7 @@ def text_to_speech(text):
|
|
84 |
return audio_fp
|
85 |
|
86 |
def main():
|
87 |
-
audio_data = audiorecorder("
|
88 |
|
89 |
if not audio_data.empty():
|
90 |
st.audio(audio_data.export().read(), format="audio/wav")
|
|
|
6 |
from audiorecorder import audiorecorder
|
7 |
import speech_recognition as sr
|
8 |
|
9 |
+
pre_prompt_text = "Eres una IA conductual, estoica y humanista."
|
10 |
|
11 |
if "history" not in st.session_state:
|
12 |
st.session_state.history = []
|
|
|
24 |
try:
|
25 |
audio_text = recognizer.recognize_google(audio, language="es-ES")
|
26 |
if show_messages:
|
27 |
+
st.subheader("Texto Reconocido:")
|
28 |
st.write(audio_text)
|
29 |
+
st.success("Voz reconocida.")
|
30 |
except sr.UnknownValueError:
|
31 |
+
st.warning("No se pudo reconocer el audio. 驴Intentaste grabar algo?")
|
32 |
audio_text = ""
|
33 |
except sr.RequestError:
|
34 |
+
st.error("隆Presiona/Habla para comenzar!")
|
35 |
audio_text = ""
|
36 |
|
37 |
return audio_text
|
|
|
84 |
return audio_fp
|
85 |
|
86 |
def main():
|
87 |
+
audio_data = audiorecorder("Presiona para Hablar", "Detener Grabaci贸n...")
|
88 |
|
89 |
if not audio_data.empty():
|
90 |
st.audio(audio_data.export().read(), format="audio/wav")
|