Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -85,19 +85,19 @@ def text_to_speech(text, speed=1.3):
|
|
85 |
def main():
|
86 |
st.title("Chatbot de Voz a Voz")
|
87 |
microphones = sr.Microphone.list_microphone_names()
|
88 |
-
|
89 |
-
if microphones:
|
90 |
-
selected_microphone_index =
|
91 |
audio_data = sr.Microphone(device_index=selected_microphone_index)
|
92 |
else:
|
93 |
st.warning("No se encontraron dispositivos.")
|
94 |
|
95 |
-
r = sr.Recognizer()
|
96 |
-
m = sr.Microphone()
|
97 |
with m as source:
|
98 |
-
r.adjust_for_ambient_noise(source)
|
99 |
st.info("Di algo para comenzar la conversaci贸n.")
|
100 |
-
stop_listening = r.listen_in_background(m, callback)
|
101 |
|
102 |
if __name__ == "__main__":
|
103 |
-
main()
|
|
|
85 |
def main():
|
86 |
st.title("Chatbot de Voz a Voz")
|
87 |
microphones = sr.Microphone.list_microphone_names()
|
88 |
+
|
89 |
+
if microphones:
|
90 |
+
selected_microphone_index = 1 if len(microphones) > 1 else 0
|
91 |
audio_data = sr.Microphone(device_index=selected_microphone_index)
|
92 |
else:
|
93 |
st.warning("No se encontraron dispositivos.")
|
94 |
|
95 |
+
r = sr.Recognizer()
|
96 |
+
m = sr.Microphone(device_index=selected_microphone_index)
|
97 |
with m as source:
|
98 |
+
r.adjust_for_ambient_noise(source)
|
99 |
st.info("Di algo para comenzar la conversaci贸n.")
|
100 |
+
stop_listening = r.listen_in_background(m, callback)
|
101 |
|
102 |
if __name__ == "__main__":
|
103 |
+
main()
|