J
File size: 2,701 Bytes
80dd10c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env python3
"""
Startup script for Aliah-Plus
Handles module imports and starts the FastAPI server
"""

import sys
import os
from pathlib import Path

# Asegurar que el directorio actual está en el path
current_dir = Path(__file__).parent.absolute()
sys.path.insert(0, str(current_dir))
sys.path.insert(0, str(current_dir / "src"))

# Verificar que los módulos existen
print("=" * 60)
print("Aliah-Plus Startup")
print("=" * 60)

print("\n[1/4] Checking Python path...")
print(f"Current directory: {current_dir}")
print(f"Python path includes: {current_dir in [Path(p) for p in sys.path]}")

print("\n[2/4] Checking source files...")
required_files = [
    "app.py",
    "src/__init__.py",
    "src/face_processor.py",
    "src/embedding_engine.py",
    "src/comparator.py",
    "src/ocr_extractor.py",
    "src/cross_referencer.py",
    "src/vector_db.py",
    "src/scrapers/__init__.py",
    "src/scrapers/stealth_engine.py",
]

missing_files = []
for file in required_files:
    file_path = current_dir / file
    if file_path.exists():
        print(f"  ✓ {file}")
    else:
        print(f"  ✗ {file} (MISSING)")
        missing_files.append(file)

if missing_files:
    print(f"\n❌ Error: Missing {len(missing_files)} required files")
    sys.exit(1)

print("\n[3/4] Testing imports...")
try:
    from src.face_processor import FaceProcessor
    print("  ✓ FaceProcessor")
except ImportError as e:
    print(f"  ✗ FaceProcessor: {e}")

try:
    from src.embedding_engine import EmbeddingEngine
    print("  ✓ EmbeddingEngine")
except ImportError as e:
    print(f"  ✗ EmbeddingEngine: {e}")

try:
    from src.comparator import FaceComparator
    print("  ✓ FaceComparator")
except ImportError as e:
    print(f"  ✗ FaceComparator: {e}")

try:
    from src.ocr_extractor import OCRExtractor
    print("  ✓ OCRExtractor")
except ImportError as e:
    print(f"  ✗ OCRExtractor: {e}")

try:
    from src.cross_referencer import CrossReferencer
    print("  ✓ CrossReferencer")
except ImportError as e:
    print(f"  ✗ CrossReferencer: {e}")

try:
    from src.vector_db import VectorDatabase
    print("  ✓ VectorDatabase")
except ImportError as e:
    print(f"  ✗ VectorDatabase: {e}")

try:
    from src.scrapers.stealth_engine import StealthSearch
    print("  ✓ StealthSearch")
except ImportError as e:
    print(f"  ✗ StealthSearch: {e}")

print("\n[4/4] Starting FastAPI server...")
print("=" * 60)

# Importar y ejecutar la aplicación
if __name__ == "__main__":
    import uvicorn
    from app import app
    
    uvicorn.run(
        app,
        host="0.0.0.0",
        port=int(os.environ.get("PORT", 7860)),
        log_level="info"
    )