| #!/bin/bash |
|
|
| |
|
|
| echo "π Starting Kronos Web UI in Docker..." |
| echo "======================================" |
|
|
| |
| SCRIPT_DIR="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" |
| cd "$SCRIPT_DIR" || { |
| echo "β Failed to change directory to $SCRIPT_DIR" |
| exit 1 |
| } |
|
|
| |
| if [ ! -f "app.py" ]; then |
| echo "β app.py not found in $(pwd), please check the working directory" |
| exit 1 |
| fi |
|
|
| |
| export PYTHONPATH=/app |
| export FLASK_APP=webui/app.py |
| export FLASK_ENV=production |
|
|
| |
| mkdir -p prediction_results |
| mkdir -p model/data |
|
|
| |
| 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') |
| " |
|
|
| |
| PORT="${PORT:-7860}" |
| echo "π Starting Flask server on port ${PORT}..." |
| echo "Access URL: http://localhost:${PORT}" |
| echo "Press Ctrl+C to stop server" |
| echo "" |
|
|
| |
| if command -v gunicorn &> /dev/null; then |
| echo "Using Gunicorn for production..." |
| exec gunicorn --bind 0.0.0.0:${PORT} --workers 2 --timeout 120 --access-logfile - --error-logfile - app:app |
| else |
| echo "Using Flask development server..." |
| exec python3 app.py |
| fi |
|
|