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
|