File size: 1,173 Bytes
ef69efc
4131431
ef69efc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4131431
 
ef69efc
 
4131431
ef69efc
 
 
 
 
 
 
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
#!/bin/bash
# Don't exit on errors - we'll handle them gracefully

echo "πŸš€ Starting Carsa AI Backend..."
echo "πŸ“ Working directory: $(pwd)"
echo "🐍 Python version: $(python --version)"

# Check if main.py exists
if [ ! -f "main.py" ]; then
    echo "❌ main.py not found!"
    exit 1
fi

# Test import before starting server
echo "πŸ” Testing imports..."
python -c "
import sys
print('βœ… Python import test...')
try:
    import fastapi
    print('βœ… FastAPI imported')
    import uvicorn
    print('βœ… Uvicorn imported')
    import torch
    print('βœ… PyTorch imported')
    print('🎯 All core imports successful!')
except ImportError as e:
    print(f'❌ Import error: {e}')
    sys.exit(1)
"

# Create cache directories with proper permissions
mkdir -p /tmp/hf_cache /tmp/numba_cache
echo "πŸ“ Cache directories ready: /tmp/hf_cache, /tmp/numba_cache"

# Set environment variables
export HF_HOME=/tmp/hf_cache
export PYTHONPATH=/app
export NUMBA_CACHE_DIR=/tmp/numba_cache
export NUMBA_DISABLE_JIT=1
echo "πŸ”§ Environment variables set"

echo "🌍 Starting server on 0.0.0.0:7860..."
python -m uvicorn main:app --host 0.0.0.0 --port 7860 --workers 1