salomonsky commited on
Commit
be363ff
verified
1 Parent(s): d9e5318

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
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 = "You are a behavioral AI, your answers should be brief, stoic and humanistic."
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("Recognized text:")
28
  st.write(audio_text)
29
- st.success("Voice Recognized.")
30
  except sr.UnknownValueError:
31
- st.warning("The audio could not be recognized. Did you try to record something?")
32
  audio_text = ""
33
  except sr.RequestError:
34
- st.error("Push/Talk to start!")
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("Push to Talk", "Stop Recording...")
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")