Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,10 @@ import tempfile
|
|
2 |
import webrtcvad
|
3 |
import speech_recognition as sr
|
4 |
import os
|
|
|
|
|
|
|
|
|
5 |
|
6 |
def process_audio_file(audio_file_path):
|
7 |
# Configuramos la tasa de muestreo y el tamaño del frame
|
@@ -47,10 +51,10 @@ def process_audio_file(audio_file_path):
|
|
47 |
if is_speech and not vad_active:
|
48 |
vad_active = True
|
49 |
speech_detected = True
|
50 |
-
|
51 |
elif not is_speech and vad_active:
|
52 |
vad_active = False
|
53 |
-
|
54 |
|
55 |
# Si se ha detectado voz y hay un silencio, transcribimos la frase
|
56 |
if speech_detected and not is_speech:
|
@@ -72,6 +76,15 @@ def process_audio_file(audio_file_path):
|
|
72 |
# Imprimimos la frase completa
|
73 |
print(f"Transcripción completa: {phrase}")
|
74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
# Example usage:
|
76 |
audio_file_path = os.path.join(os.getcwd(), "audio.wav") # Replace "audio.wav" with your actual file name
|
77 |
process_audio_file(audio_file_path)
|
|
|
|
|
|
2 |
import webrtcvad
|
3 |
import speech_recognition as sr
|
4 |
import os
|
5 |
+
import tkinter as tk
|
6 |
+
|
7 |
+
def update_vad_status(status):
|
8 |
+
vad_status_label.config(text=status)
|
9 |
|
10 |
def process_audio_file(audio_file_path):
|
11 |
# Configuramos la tasa de muestreo y el tamaño del frame
|
|
|
51 |
if is_speech and not vad_active:
|
52 |
vad_active = True
|
53 |
speech_detected = True
|
54 |
+
update_vad_status("️ Detección de voz iniciada")
|
55 |
elif not is_speech and vad_active:
|
56 |
vad_active = False
|
57 |
+
update_vad_status("⏹️ Detección de voz finalizada")
|
58 |
|
59 |
# Si se ha detectado voz y hay un silencio, transcribimos la frase
|
60 |
if speech_detected and not is_speech:
|
|
|
76 |
# Imprimimos la frase completa
|
77 |
print(f"Transcripción completa: {phrase}")
|
78 |
|
79 |
+
# Tkinter GUI
|
80 |
+
root = tk.Tk()
|
81 |
+
root.title("VAD Status")
|
82 |
+
|
83 |
+
vad_status_label = tk.Label(root, text="", font=("Helvetica", 14))
|
84 |
+
vad_status_label.pack(pady=20)
|
85 |
+
|
86 |
# Example usage:
|
87 |
audio_file_path = os.path.join(os.getcwd(), "audio.wav") # Replace "audio.wav" with your actual file name
|
88 |
process_audio_file(audio_file_path)
|
89 |
+
|
90 |
+
root.mainloop()
|