Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -63,9 +63,14 @@ def format_as_srt(transcription):
|
|
| 63 |
return ''.join(srt_output)
|
| 64 |
|
| 65 |
def process_audio(file):
|
| 66 |
-
#
|
|
|
|
| 67 |
audio_file_path = file[0] if isinstance(file, tuple) else file
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
# Transcribir el audio y generar subtítulos
|
| 70 |
transcription = transcribe_audio(audio_file_path)
|
| 71 |
srt_content = format_as_srt(transcription)
|
|
@@ -76,6 +81,7 @@ def process_audio(file):
|
|
| 76 |
|
| 77 |
return transcription, 'subtitles.srt'
|
| 78 |
|
|
|
|
| 79 |
# Crear la interfaz Gradio
|
| 80 |
iface = gr.Interface(
|
| 81 |
fn=process_audio,
|
|
|
|
| 63 |
return ''.join(srt_output)
|
| 64 |
|
| 65 |
def process_audio(file):
|
| 66 |
+
# Asegurarse de que el archivo de audio está siendo tratado correctamente
|
| 67 |
+
# El archivo puede venir como una tupla (ruta, tipo) o como un solo archivo
|
| 68 |
audio_file_path = file[0] if isinstance(file, tuple) else file
|
| 69 |
|
| 70 |
+
# Comprobar si audio_file_path es realmente una cadena
|
| 71 |
+
if not isinstance(audio_file_path, str):
|
| 72 |
+
raise ValueError("El archivo de audio no es una cadena válida.")
|
| 73 |
+
|
| 74 |
# Transcribir el audio y generar subtítulos
|
| 75 |
transcription = transcribe_audio(audio_file_path)
|
| 76 |
srt_content = format_as_srt(transcription)
|
|
|
|
| 81 |
|
| 82 |
return transcription, 'subtitles.srt'
|
| 83 |
|
| 84 |
+
|
| 85 |
# Crear la interfaz Gradio
|
| 86 |
iface = gr.Interface(
|
| 87 |
fn=process_audio,
|