Spaces:
Sleeping
Sleeping
traduccion
Browse files
app.py
CHANGED
|
@@ -10,13 +10,13 @@ import tempfile
|
|
| 10 |
|
| 11 |
# Cargar el modelo Whisper-small y bark
|
| 12 |
transcribir = pipeline("automatic-speech-recognition", model="openai/whisper-small")
|
| 13 |
-
bark = pipeline("text-to-speech", model="suno/bark")
|
| 14 |
|
| 15 |
|
| 16 |
# Funci贸n para transcribir el audio y traducir el audio de entrada
|
| 17 |
def transcribir_audio(audio):
|
| 18 |
# Usamos el pipeline de Hugging Face para la transcripci贸n
|
| 19 |
-
result = transcribir_audio(
|
| 20 |
return result["text"]
|
| 21 |
|
| 22 |
|
|
@@ -37,7 +37,7 @@ def generar_audio(text):
|
|
| 37 |
|
| 38 |
def process_audio(audio_file):
|
| 39 |
# Paso 1: Transcripci贸n y traducci贸n con Whisper
|
| 40 |
-
transcripcion_traducida = transcribir(audio_file)["text"]
|
| 41 |
|
| 42 |
# Paso 2: Generaci贸n de audio con Bark
|
| 43 |
audio_sintetizado = generar_audio(transcripcion_traducida)
|
|
@@ -51,11 +51,11 @@ with gr.Blocks() as demo:
|
|
| 51 |
|
| 52 |
with gr.Row():
|
| 53 |
input_audio = gr.Audio(label="Sube tu archivo de audio", type="filepath")
|
| 54 |
-
transcription_output = gr.Textbox(label="Texto
|
| 55 |
output_audio = gr.Audio(label="Audio generado")
|
| 56 |
|
| 57 |
process_button = gr.Button("Procesar")
|
| 58 |
process_button.click(process_audio, inputs=input_audio, outputs=[transcription_output, output_audio])
|
| 59 |
|
| 60 |
# Lanzar la app
|
| 61 |
-
demo.launch()
|
|
|
|
| 10 |
|
| 11 |
# Cargar el modelo Whisper-small y bark
|
| 12 |
transcribir = pipeline("automatic-speech-recognition", model="openai/whisper-small")
|
| 13 |
+
"""bark = pipeline("text-to-speech", model="suno/bark")"""
|
| 14 |
|
| 15 |
|
| 16 |
# Funci贸n para transcribir el audio y traducir el audio de entrada
|
| 17 |
def transcribir_audio(audio):
|
| 18 |
# Usamos el pipeline de Hugging Face para la transcripci贸n
|
| 19 |
+
result = transcribir_audio(audio_file, task="translate")
|
| 20 |
return result["text"]
|
| 21 |
|
| 22 |
|
|
|
|
| 37 |
|
| 38 |
def process_audio(audio_file):
|
| 39 |
# Paso 1: Transcripci贸n y traducci贸n con Whisper
|
| 40 |
+
transcripcion_traducida = transcribir(audio_file)"""["text"]"""
|
| 41 |
|
| 42 |
# Paso 2: Generaci贸n de audio con Bark
|
| 43 |
audio_sintetizado = generar_audio(transcripcion_traducida)
|
|
|
|
| 51 |
|
| 52 |
with gr.Row():
|
| 53 |
input_audio = gr.Audio(label="Sube tu archivo de audio", type="filepath")
|
| 54 |
+
transcription_output = gr.Textbox(label="Texto traducido al ingl茅s")
|
| 55 |
output_audio = gr.Audio(label="Audio generado")
|
| 56 |
|
| 57 |
process_button = gr.Button("Procesar")
|
| 58 |
process_button.click(process_audio, inputs=input_audio, outputs=[transcription_output, output_audio])
|
| 59 |
|
| 60 |
# Lanzar la app
|
| 61 |
+
demo.launch()
|