Upload app.py
Browse files
app.py
CHANGED
@@ -2,21 +2,19 @@
|
|
2 |
import sys
|
3 |
from pathlib import Path
|
4 |
import os
|
5 |
-
import subprocess
|
6 |
|
7 |
-
# --- CR脥TICO: L脥NEA PARA FORZAR LA VERSI脫N DE GRADIO ---
|
8 |
-
|
9 |
-
# y luego instalar la versi贸n deseada antes de cualquier importaci贸n de gradio.
|
10 |
-
# Esto es necesario si el entorno de HF Spaces o tu sistema est谩 sobreescribiendo las versiones.
|
11 |
-
print("INFO: Forzando la instalaci贸n de Gradio 4.29.0...")
|
12 |
try:
|
13 |
# Desinstalar cualquier versi贸n existente de gradio y gradio_client
|
14 |
subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "-y", "gradio", "gradio-client"])
|
15 |
-
# Instalar la versi贸n espec铆fica deseada
|
16 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==4.29.0", "gradio-client==
|
17 |
-
print("INFO: Gradio 4.29.0
|
18 |
except subprocess.CalledProcessError as e:
|
19 |
print(f"ERROR: Fallo al forzar la instalaci贸n de Gradio 4.29.0: {e}")
|
|
|
20 |
sys.exit(1)
|
21 |
# --- FIN DE L脥NEA CR脥TICA ---
|
22 |
|
@@ -52,7 +50,7 @@ def main():
|
|
52 |
|
53 |
print("INFO (app.py): Lanzando la interfaz Gradio localmente...")
|
54 |
try:
|
55 |
-
demo_instance.launch(debug=True)
|
56 |
except ValueError as ve:
|
57 |
if "shareable link must be created" in str(ve).lower() or "localhost is not accessible" in str(ve).lower():
|
58 |
print("ADVERTENCIA (app.py): Fall贸 el lanzamiento local directo, intentando con share=True...")
|
|
|
2 |
import sys
|
3 |
from pathlib import Path
|
4 |
import os
|
5 |
+
import subprocess
|
6 |
|
7 |
+
# --- CR脥TICO: L脥NEA PARA FORZAR LA VERSI脫N DE GRADIO Y GRADIO-CLIENT CORRECTA ---
|
8 |
+
print("INFO: Forzando la instalaci贸n de Gradio 4.29.0 y su cliente compatible...")
|
|
|
|
|
|
|
9 |
try:
|
10 |
# Desinstalar cualquier versi贸n existente de gradio y gradio_client
|
11 |
subprocess.check_call([sys.executable, "-m", "pip", "uninstall", "-y", "gradio", "gradio-client"])
|
12 |
+
# Instalar la versi贸n espec铆fica deseada: gradio 4.29.0 necesita gradio-client 0.16.1
|
13 |
+
subprocess.check_call([sys.executable, "-m", "pip", "install", "gradio==4.29.0", "gradio-client==0.16.1"])
|
14 |
+
print("INFO: Gradio 4.29.0 y gradio-client 0.16.1 instalados correctamente de forma forzada.")
|
15 |
except subprocess.CalledProcessError as e:
|
16 |
print(f"ERROR: Fallo al forzar la instalaci贸n de Gradio 4.29.0: {e}")
|
17 |
+
print("Por favor, aseg煤rate de que no hay otras dependencias conflictivas y reintenta despu茅s de una limpieza profunda.")
|
18 |
sys.exit(1)
|
19 |
# --- FIN DE L脥NEA CR脥TICA ---
|
20 |
|
|
|
50 |
|
51 |
print("INFO (app.py): Lanzando la interfaz Gradio localmente...")
|
52 |
try:
|
53 |
+
demo_instance.launch(debug=True)
|
54 |
except ValueError as ve:
|
55 |
if "shareable link must be created" in str(ve).lower() or "localhost is not accessible" in str(ve).lower():
|
56 |
print("ADVERTENCIA (app.py): Fall贸 el lanzamiento local directo, intentando con share=True...")
|