Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,41 +49,39 @@ def analizar_audio_evp(audio_path, progress=gr.Progress()):
|
|
| 49 |
progress(1.0, desc="Análisis completado")
|
| 50 |
|
| 51 |
if texto:
|
| 52 |
-
return f"👻
|
| 53 |
else:
|
| 54 |
-
return "💤
|
| 55 |
|
| 56 |
except RuntimeError as e:
|
| 57 |
if "out of memory" in str(e).lower():
|
| 58 |
-
return "⚠️
|
| 59 |
-
return f"⚠️
|
| 60 |
except Exception as e:
|
| 61 |
-
return f"⚠️
|
| 62 |
|
| 63 |
# --- Interfaz ---
|
| 64 |
with gr.Blocks() as demo:
|
| 65 |
gr.Markdown("""
|
| 66 |
-
#
|
| 67 |
-
## Sube un MP3 de
|
| 68 |
*La IA intentará encontrar palabras donde solo hay ruido estático.*
|
| 69 |
""")
|
| 70 |
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column():
|
| 73 |
audio_input = gr.Audio(
|
| 74 |
-
label="
|
| 75 |
type="filepath",
|
| 76 |
-
sources=["upload", "microphone"]
|
| 77 |
-
format="mp3"
|
| 78 |
)
|
| 79 |
-
btn_analizar = gr.Button("
|
| 80 |
|
| 81 |
with gr.Column():
|
| 82 |
output_text = gr.Textbox(
|
| 83 |
-
label="
|
| 84 |
lines=6,
|
| 85 |
-
max_lines=12
|
| 86 |
-
show_copy_button=True
|
| 87 |
)
|
| 88 |
|
| 89 |
btn_analizar.click(
|
|
@@ -92,12 +90,9 @@ with gr.Blocks() as demo:
|
|
| 92 |
outputs=output_text
|
| 93 |
)
|
| 94 |
|
| 95 |
-
# --- Lanzamiento
|
| 96 |
if __name__ == "__main__":
|
| 97 |
demo.launch(
|
| 98 |
server_name="0.0.0.0",
|
| 99 |
-
server_port=7860
|
| 100 |
-
# ✅ NO pongas auth= para nada
|
| 101 |
-
# ✅ NO pongas share=True
|
| 102 |
-
theme=gr.themes.Soft(primary_hue="purple")
|
| 103 |
)
|
|
|
|
| 49 |
progress(1.0, desc="Análisis completado")
|
| 50 |
|
| 51 |
if texto:
|
| 52 |
+
return f"👻 PATRÓN DETECTADO:\n\n{texto}"
|
| 53 |
else:
|
| 54 |
+
return "💤 SIN PATRONES CLAROS:\n\nLa IA no encontró estructuras lingüísticas reconocibles en este audio."
|
| 55 |
|
| 56 |
except RuntimeError as e:
|
| 57 |
if "out of memory" in str(e).lower():
|
| 58 |
+
return "⚠️ MEMORIA INSUFICIENTE:\n\nEl espacio gratuito se quedó sin recursos. Espera unos minutos y reintenta con un audio más corto (<15s)."
|
| 59 |
+
return f"⚠️ ERROR DE EJECUCIÓN:\n\n{str(e)}"
|
| 60 |
except Exception as e:
|
| 61 |
+
return f"⚠️ ERROR:\n\n{type(e).__name__}: {str(e)}"
|
| 62 |
|
| 63 |
# --- Interfaz ---
|
| 64 |
with gr.Blocks() as demo:
|
| 65 |
gr.Markdown("""
|
| 66 |
+
# Detector de Patrones Auditivos (EVP)
|
| 67 |
+
## Sube un MP3 de silencio o graba tu habitación.
|
| 68 |
*La IA intentará encontrar palabras donde solo hay ruido estático.*
|
| 69 |
""")
|
| 70 |
|
| 71 |
with gr.Row():
|
| 72 |
with gr.Column():
|
| 73 |
audio_input = gr.Audio(
|
| 74 |
+
label="Fuente de Audio",
|
| 75 |
type="filepath",
|
| 76 |
+
sources=["upload", "microphone"]
|
|
|
|
| 77 |
)
|
| 78 |
+
btn_analizar = gr.Button("Analizar Ruido", variant="primary")
|
| 79 |
|
| 80 |
with gr.Column():
|
| 81 |
output_text = gr.Textbox(
|
| 82 |
+
label="Resultado del Análisis",
|
| 83 |
lines=6,
|
| 84 |
+
max_lines=12
|
|
|
|
| 85 |
)
|
| 86 |
|
| 87 |
btn_analizar.click(
|
|
|
|
| 90 |
outputs=output_text
|
| 91 |
)
|
| 92 |
|
| 93 |
+
# --- Lanzamiento ---
|
| 94 |
if __name__ == "__main__":
|
| 95 |
demo.launch(
|
| 96 |
server_name="0.0.0.0",
|
| 97 |
+
server_port=7860
|
|
|
|
|
|
|
|
|
|
| 98 |
)
|