Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -117,4 +117,21 @@ def main():
|
|
117 |
except sr.UnknownValueError:
|
118 |
pass
|
119 |
|
120 |
-
if selected_device_index is not
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
except sr.UnknownValueError:
|
118 |
pass
|
119 |
|
120 |
+
if selected_device_index is not None:
|
121 |
+
print(f"Usando el dispositivo {selected_device_index}")
|
122 |
+
with sr.Microphone(device_index=selected_device_index) as source:
|
123 |
+
print("Habla ahora...")
|
124 |
+
|
125 |
+
stream = source.stream
|
126 |
+
while True:
|
127 |
+
frames, overflowed = stream.read(1024)
|
128 |
+
if overflowed:
|
129 |
+
print("Overflowed!")
|
130 |
+
continue
|
131 |
+
|
132 |
+
process_audio(frames, r, vad)
|
133 |
+
else:
|
134 |
+
print("No se encontraron dispositivos de micr贸fono v谩lidos. Saliendo.")
|
135 |
+
|
136 |
+
if __name__ == "__main__":
|
137 |
+
main()
|