Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -6,16 +6,17 @@ from gtts import gTTS
|
|
6 |
from audiorecorder import audiorecorder
|
7 |
import speech_recognition as sr
|
8 |
from pydub import AudioSegment
|
9 |
-
import Microphone, Recognizer
|
|
|
10 |
|
11 |
if "history" not in st.session_state:
|
12 |
st.session_state.history = []
|
13 |
|
14 |
def recognize_speech(audio_data, show_messages=True):
|
15 |
recognizer = sr.Recognizer()
|
16 |
-
|
17 |
microphone_list = sr.Microphone.list_working_microphones()
|
18 |
-
|
|
|
19 |
if not microphone_list:
|
20 |
raise ValueError("No se encontraron micr贸fonos funcionando.")
|
21 |
|
|
|
6 |
from audiorecorder import audiorecorder
|
7 |
import speech_recognition as sr
|
8 |
from pydub import AudioSegment
|
9 |
+
from speech_recognition import Microphone, Recognizer
|
10 |
+
import pyttsx3
|
11 |
|
12 |
if "history" not in st.session_state:
|
13 |
st.session_state.history = []
|
14 |
|
15 |
def recognize_speech(audio_data, show_messages=True):
|
16 |
recognizer = sr.Recognizer()
|
|
|
17 |
microphone_list = sr.Microphone.list_working_microphones()
|
18 |
+
adjust_for_ambient_noise(source, 1)
|
19 |
+
|
20 |
if not microphone_list:
|
21 |
raise ValueError("No se encontraron micr贸fonos funcionando.")
|
22 |
|