DanceDynamics / startup.sh
Prathamesh Sarjerao Vaidya
made changes to fix 503 hf space error
9f01b99
#!/bin/bash
set -e
echo "πŸš€ Starting DanceDynamics on Hugging Face Spaces..."
# Get port from environment or use default
PORT=${PORT:-7860}
echo "πŸ“ Port: $PORT"
echo "πŸ“‚ Working Directory: $(pwd)"
echo "πŸ“ Contents:"
ls -la
# Check if required directories exist
echo ""
echo "πŸ” Checking structure..."
if [ -d "/app/frontend" ]; then
echo "βœ… Frontend directory found"
ls -la /app/frontend | head -5
else
echo "⚠️ Frontend directory not found at /app/frontend"
fi
if [ -d "/app/app" ]; then
echo "βœ… App directory found"
else
echo "⚠️ App directory not found at /app/app"
fi
# Create necessary directories
echo ""
echo "πŸ“ Creating upload/output directories..."
mkdir -p /app/uploads /app/outputs /app/logs
chmod 755 /app/uploads /app/outputs /app/logs
# Check Python environment
echo ""
echo "🐍 Python environment:"
python --version
echo "πŸ“¦ Installed packages (key ones):"
pip list | grep -E "(fastapi|uvicorn|mediapipe|opencv)"
# Start the application
echo ""
echo "🎬 Starting FastAPI server..."
exec uvicorn app.main:app \
--host 0.0.0.0 \
--port $PORT \
--workers 1 \
--log-level info \
--access-log \
--timeout-keep-alive 30 \
--no-use-colors