Update preprocessing_router.py
Browse files- preprocessing_router.py +18 -22
preprocessing_router.py
CHANGED
|
@@ -206,28 +206,6 @@ async def load_casting(
|
|
| 206 |
db_dir: str = Form("chroma_db"),
|
| 207 |
drop_collections: bool = Form(False),
|
| 208 |
):
|
| 209 |
-
|
| 210 |
-
# --- DEBUG DE RUTAS ---
|
| 211 |
-
print("👇 --- INFORMACIÓN DE RUTAS DE CÁSTING ---")
|
| 212 |
-
print(f"Ruta de caras (faces_dir): {faces_dir}")
|
| 213 |
-
print(f"Ruta de voces (voices_dir): {voices_dir}")
|
| 214 |
-
print(f"Ruta de DB (db_dir): {db_dir}")
|
| 215 |
-
|
| 216 |
-
# Listar qué archivos hay dentro de la carpeta de caras
|
| 217 |
-
if faces_dir and os.path.exists(faces_dir):
|
| 218 |
-
# Esto te dirá si hay subcarpetas o imágenes directas
|
| 219 |
-
contenido = os.listdir(faces_dir)
|
| 220 |
-
print(f"Archivos/Carpetas en faces_dir: {contenido}")
|
| 221 |
-
|
| 222 |
-
# Si quieres ver qué hay dentro de la primera subcarpeta (ej. 'Ana')
|
| 223 |
-
for item in contenido:
|
| 224 |
-
subruta = os.path.join(faces_dir, item)
|
| 225 |
-
if os.path.isdir(subruta):
|
| 226 |
-
print(f" Contenido de {item}: {os.listdir(subruta)[:5]}...") # Muestra los primeros 5 archivos
|
| 227 |
-
else:
|
| 228 |
-
print("⚠️ La ruta de caras no existe o está vacía.")
|
| 229 |
-
print("--- FIN DEL DEBUG --- 👆")
|
| 230 |
-
|
| 231 |
client = ensure_chroma(Path(db_dir))
|
| 232 |
n_faces = build_faces_index(Path(faces_dir), client, collection_name="index_faces", drop=drop_collections)
|
| 233 |
n_voices = build_voices_index(Path(voices_dir), client, collection_name="index_voices", drop=drop_collections)
|
|
@@ -257,6 +235,24 @@ async def finalize_casting(
|
|
| 257 |
video_hash = payload.get("video_hash") or "empty"
|
| 258 |
voice_clusters = payload.get("voice_clusters", []) or []
|
| 259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
MEDIA_ROOT = _P("/data/media")
|
| 261 |
video_hash = find_video_hash(video_name+".mp4",MEDIA_ROOT)
|
| 262 |
if not video_name or not base_dir:
|
|
|
|
| 206 |
db_dir: str = Form("chroma_db"),
|
| 207 |
drop_collections: bool = Form(False),
|
| 208 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 209 |
client = ensure_chroma(Path(db_dir))
|
| 210 |
n_faces = build_faces_index(Path(faces_dir), client, collection_name="index_faces", drop=drop_collections)
|
| 211 |
n_voices = build_voices_index(Path(voices_dir), client, collection_name="index_voices", drop=drop_collections)
|
|
|
|
| 235 |
video_hash = payload.get("video_hash") or "empty"
|
| 236 |
voice_clusters = payload.get("voice_clusters", []) or []
|
| 237 |
|
| 238 |
+
# --- DEBUG DE PERSONAJES RECIBIDOS ---
|
| 239 |
+
print("\n" + "="*50)
|
| 240 |
+
print(f"DEBUG: RECIBIENDO PERSONAJES PARA EL VÍDEO: {video_name}")
|
| 241 |
+
print("="*50)
|
| 242 |
+
|
| 243 |
+
for idx, char in enumerate(characters):
|
| 244 |
+
c_name = char.get("name", "Sin nombre")
|
| 245 |
+
c_folder = char.get("folder", "Sin carpeta")
|
| 246 |
+
c_files = char.get("kept_files", [])
|
| 247 |
+
|
| 248 |
+
print(f"👤 Personaje {idx+1}: {c_name}")
|
| 249 |
+
print(f" 📂 Carpeta origen: {c_folder}")
|
| 250 |
+
print(f" 🖼️ Archivos seleccionados ({len(c_files)}):")
|
| 251 |
+
for f in c_files:
|
| 252 |
+
print(f" - {f}")
|
| 253 |
+
print("-" * 30)
|
| 254 |
+
print("="*50 + "\n")
|
| 255 |
+
|
| 256 |
MEDIA_ROOT = _P("/data/media")
|
| 257 |
video_hash = find_video_hash(video_name+".mp4",MEDIA_ROOT)
|
| 258 |
if not video_name or not base_dir:
|