Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -112,6 +112,10 @@ def start_stream():
|
|
112 |
detection = voice_activity_detection(audio_data)
|
113 |
print(detection)
|
114 |
|
|
|
|
|
|
|
|
|
115 |
class Threader(threading.Thread):
|
116 |
def __init__(self, *args, **kwargs):
|
117 |
threading.Thread.__init__(self, *args, **kwargs)
|
@@ -127,9 +131,8 @@ if __name__ == "__main__":
|
|
127 |
st.write("Record your voice, and play the recorded audio:")
|
128 |
audio = mic_recorder(start_prompt="▶️", stop_prompt="🛑", key='recorder')
|
129 |
|
130 |
-
if audio:
|
131 |
st.audio(audio['bytes'])
|
132 |
-
|
133 |
audio_bytes = audio["bytes"]
|
134 |
sample_width = audio["sample_width"]
|
135 |
sample_rate = audio["sample_rate"]
|
@@ -142,10 +145,9 @@ if __name__ == "__main__":
|
|
142 |
wave_file.writeframes(audio_bytes)
|
143 |
|
144 |
vad = webrtcvad.Vad(1)
|
145 |
-
|
146 |
channels = [1]
|
147 |
mapping = [c - 1 for c in channels]
|
148 |
-
sample_rate = int(sr.AudioFile(temp_audio_file_path).
|
149 |
interval_size = 10
|
150 |
downsample = 1
|
151 |
block_size = int(sample_rate * interval_size / 1000)
|
|
|
112 |
detection = voice_activity_detection(audio_data)
|
113 |
print(detection)
|
114 |
|
115 |
+
audio_text = recognize_speech(temp_audio_file_path)
|
116 |
+
st.subheader("Texto Reconocido:")
|
117 |
+
st.write(audio_text)
|
118 |
+
|
119 |
class Threader(threading.Thread):
|
120 |
def __init__(self, *args, **kwargs):
|
121 |
threading.Thread.__init__(self, *args, **kwargs)
|
|
|
131 |
st.write("Record your voice, and play the recorded audio:")
|
132 |
audio = mic_recorder(start_prompt="▶️", stop_prompt="🛑", key='recorder')
|
133 |
|
134 |
+
if audio:
|
135 |
st.audio(audio['bytes'])
|
|
|
136 |
audio_bytes = audio["bytes"]
|
137 |
sample_width = audio["sample_width"]
|
138 |
sample_rate = audio["sample_rate"]
|
|
|
145 |
wave_file.writeframes(audio_bytes)
|
146 |
|
147 |
vad = webrtcvad.Vad(1)
|
|
|
148 |
channels = [1]
|
149 |
mapping = [c - 1 for c in channels]
|
150 |
+
sample_rate = int(sr.AudioFile(temp_audio_file_path)._samples_per_second)
|
151 |
interval_size = 10
|
152 |
downsample = 1
|
153 |
block_size = int(sample_rate * interval_size / 1000)
|