Spaces:
Paused
Paused
Upload 9 files
Browse files- app.py +32 -9
- requirements.txt +0 -1
app.py
CHANGED
|
@@ -14,20 +14,34 @@ from PIL import Image
|
|
| 14 |
# --- IMPORTAÇÃO DOS SERVIÇOS DE BACKEND E UTILS ---
|
| 15 |
# ==============================================================================
|
| 16 |
|
| 17 |
-
|
| 18 |
# --- MUDANÇA PRINCIPAL: Importamos apenas o ORQUESTRADOR ---
|
| 19 |
# O orquestrador é agora nosso único ponto de entrada para a geração de vídeo.
|
| 20 |
-
from api.
|
| 21 |
|
| 22 |
# O SeedVR (upscaler de resolução) ainda é um serviço separado que pode ser chamado após a geração.
|
| 23 |
-
from api.seedvr.
|
| 24 |
|
| 25 |
# Nosso decorador de logging para depuração
|
| 26 |
-
from utils.debug_utils import log_function_io
|
| 27 |
|
| 28 |
-
logging.info("All backend services (Orchestrator, SeedVR) and debug utils imported successfully.")
|
| 29 |
-
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
# ==============================================================================
|
| 33 |
# --- FUNÇÕES WRAPPER (PONTE ENTRE UI E BACKEND) ---
|
|
@@ -199,5 +213,14 @@ def _register_event_handlers(app_state: gr.State, ui: dict):
|
|
| 199 |
# ==============================================================================
|
| 200 |
|
| 201 |
if __name__ == "__main__":
|
| 202 |
-
|
| 203 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# --- IMPORTAÇÃO DOS SERVIÇOS DE BACKEND E UTILS ---
|
| 15 |
# ==============================================================================
|
| 16 |
|
| 17 |
+
try:
|
| 18 |
# --- MUDANÇA PRINCIPAL: Importamos apenas o ORQUESTRADOR ---
|
| 19 |
# O orquestrador é agora nosso único ponto de entrada para a geração de vídeo.
|
| 20 |
+
from api.ltx_aduc_orchestrator import ltx_aduc_orchestrator
|
| 21 |
|
| 22 |
# O SeedVR (upscaler de resolução) ainda é um serviço separado que pode ser chamado após a geração.
|
| 23 |
+
from api.seedvr.seed_aduc_pipeline import seed_aduc_pipeline
|
| 24 |
|
| 25 |
# Nosso decorador de logging para depuração
|
| 26 |
+
from utils.debug_utils import log_function_io
|
| 27 |
|
| 28 |
+
logging.info("All backend services (Orchestrator, SeedVR) and debug utils imported successfully.")
|
| 29 |
+
|
| 30 |
+
except ImportError as e:
|
| 31 |
+
# Lógica de falha para o decorador de log
|
| 32 |
+
def log_function_io(func): return func
|
| 33 |
+
logging.warning(f"Could not import a module. Debug logger might be disabled. Details: {e}")
|
| 34 |
+
# Verifica se o orquestrador, que é CRÍTICO, falhou ao importar.
|
| 35 |
+
if 'ltx_aduc_orchestrator' not in locals() or ltx_aduc_orchestrator is None:
|
| 36 |
+
logging.critical(f"FATAL: Main Orchestrator service failed to import or initialize.", exc_info=True)
|
| 37 |
+
sys.exit(1)
|
| 38 |
+
# SeedVR é opcional, então apenas avisamos se ele falhar.
|
| 39 |
+
if 'seed_aduc_pipeline' not in locals():
|
| 40 |
+
seed_aduc_pipeline = None
|
| 41 |
+
logging.warning("SeedVR server could not be initialized. The SeedVR upscaling tab will be disabled.")
|
| 42 |
+
except Exception as e:
|
| 43 |
+
logging.critical(f"FATAL ERROR: An unexpected error occurred during backend initialization. Details: {e}", exc_info=True)
|
| 44 |
+
sys.exit(1)
|
| 45 |
|
| 46 |
# ==============================================================================
|
| 47 |
# --- FUNÇÕES WRAPPER (PONTE ENTRE UI E BACKEND) ---
|
|
|
|
| 213 |
# ==============================================================================
|
| 214 |
|
| 215 |
if __name__ == "__main__":
|
| 216 |
+
log_level = os.environ.get("ADUC_LOG_LEVEL", "INFO").upper()
|
| 217 |
+
logging.basicConfig(level=log_level, format='[%(levelname)s] [%(name)s] %(message)s')
|
| 218 |
+
|
| 219 |
+
print("Building Gradio UI...")
|
| 220 |
+
gradio_app = build_ui()
|
| 221 |
+
print("Launching Gradio app...")
|
| 222 |
+
gradio_app.queue().launch(
|
| 223 |
+
server_name=os.getenv("GRADIO_SERVER_NAME", "0.0.0.0"),
|
| 224 |
+
server_port=int(os.getenv("GRADIO_SERVER_PORT", "7860")),
|
| 225 |
+
show_error=True
|
| 226 |
+
)
|
requirements.txt
CHANGED
|
@@ -5,7 +5,6 @@ pillow
|
|
| 5 |
numpy
|
| 6 |
torchvision
|
| 7 |
huggingface_hub
|
| 8 |
-
safetensors
|
| 9 |
spaces
|
| 10 |
opencv-python
|
| 11 |
imageio
|
|
|
|
| 5 |
numpy
|
| 6 |
torchvision
|
| 7 |
huggingface_hub
|
|
|
|
| 8 |
spaces
|
| 9 |
opencv-python
|
| 10 |
imageio
|