asdrolf
commited on
Commit
·
a221e42
1
Parent(s):
7194d34
ok
Browse files- app.py +11 -4
- requirements.txt +1 -1
app.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from
|
| 3 |
from faster_whisper import WhisperModel
|
| 4 |
from pyannote.audio import Pipeline
|
| 5 |
import pyannote.core
|
|
@@ -63,12 +63,16 @@ def main():
|
|
| 63 |
by Wallner Group
|
| 64 |
""", unsafe_allow_html=True)
|
| 65 |
|
| 66 |
-
|
| 67 |
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
| 69 |
# Guardar el archivo de audio grabado
|
| 70 |
with open("audio_temp.wav", "wb") as f:
|
| 71 |
-
f.write(
|
|
|
|
| 72 |
|
| 73 |
# Opción para cargar archivo de audio
|
| 74 |
audio_file = st.file_uploader("Cargar archivo de audio", type=['wav'])
|
|
@@ -77,7 +81,10 @@ def main():
|
|
| 77 |
# Guardar el archivo de audio cargado
|
| 78 |
with open("audio_temp.wav", "wb") as f:
|
| 79 |
f.write(audio_file.getbuffer())
|
|
|
|
| 80 |
|
|
|
|
|
|
|
| 81 |
# Cargar y ejecutar los modelos
|
| 82 |
speaker_segments = process_audio("audio_temp.wav")
|
| 83 |
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from audio_recorder_streamlit import audio_recorder
|
| 3 |
from faster_whisper import WhisperModel
|
| 4 |
from pyannote.audio import Pipeline
|
| 5 |
import pyannote.core
|
|
|
|
| 63 |
by Wallner Group
|
| 64 |
""", unsafe_allow_html=True)
|
| 65 |
|
| 66 |
+
audio_ready = False # Variable para indicar si el audio está listo para ser procesado
|
| 67 |
|
| 68 |
+
# Widget de grabación de audio
|
| 69 |
+
audio_bytes = audio_recorder()
|
| 70 |
+
|
| 71 |
+
if audio_bytes:
|
| 72 |
# Guardar el archivo de audio grabado
|
| 73 |
with open("audio_temp.wav", "wb") as f:
|
| 74 |
+
f.write(audio_bytes)
|
| 75 |
+
audio_ready = True
|
| 76 |
|
| 77 |
# Opción para cargar archivo de audio
|
| 78 |
audio_file = st.file_uploader("Cargar archivo de audio", type=['wav'])
|
|
|
|
| 81 |
# Guardar el archivo de audio cargado
|
| 82 |
with open("audio_temp.wav", "wb") as f:
|
| 83 |
f.write(audio_file.getbuffer())
|
| 84 |
+
audio_ready = True
|
| 85 |
|
| 86 |
+
# Procesar el audio si está listo
|
| 87 |
+
if audio_ready:
|
| 88 |
# Cargar y ejecutar los modelos
|
| 89 |
speaker_segments = process_audio("audio_temp.wav")
|
| 90 |
|
requirements.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
faster_whisper
|
| 2 |
pyannote.audio
|
| 3 |
pyannote.core
|
| 4 |
-
|
|
|
|
| 1 |
faster_whisper
|
| 2 |
pyannote.audio
|
| 3 |
pyannote.core
|
| 4 |
+
audio-recorder-streamlit
|