crypt / webui /docker_start.sh
heyunfei's picture
Upload 56 files
85653bc verified
raw
history blame
1.31 kB
#!/bin/bash
# Kronos Web UI Docker startup script
echo "πŸš€ Starting Kronos Web UI in Docker..."
echo "======================================"
# Check if we're in the correct directory
if [ ! -f "app.py" ]; then
echo "❌ app.py not found, please check the working directory"
exit 1
fi
# Set environment variables
export PYTHONPATH=/app
export FLASK_APP=webui/app.py
export FLASK_ENV=production
# Create necessary directories
mkdir -p prediction_results
mkdir -p model/data
# Check if model is available
python3 -c "
try:
from model import Kronos, KronosTokenizer, KronosPredictor
print('βœ… Kronos model library available')
except ImportError as e:
print(f'⚠️ Kronos model library not available: {e}')
print(' Will use simulated data for demonstration')
"
# Start the Flask application
echo "🌐 Starting Flask server on port 7860..."
echo "Access URL: http://localhost:7860"
echo "Press Ctrl+C to stop server"
echo ""
# Use gunicorn for production if available, otherwise use Flask dev server
if command -v gunicorn &> /dev/null; then
echo "Using Gunicorn for production..."
exec gunicorn --bind 0.0.0.0:7860 --workers 2 --timeout 120 --access-logfile - --error-logfile - app:app
else
echo "Using Flask development server..."
exec python3 app.py
fi