Spaces:
Running
on
Zero
Running
on
Zero
File size: 927 Bytes
43bfad5 |
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 |
#!/bin/sh
# Exit immediately if a command exits with a non-zero status.
set -e
echo "Starting in APP_MODE: $APP_MODE"
# --- Start the app based on mode ---
if [ "$APP_MODE" = "lambda" ]; then
echo "Starting in Lambda mode..."
# The CMD from Dockerfile will be passed as "$@"
exec python -m awslambdaric "$@"
else
echo "Starting in Gradio/FastAPI mode..."
if [ "$RUN_FASTAPI" = "True" ]; then
echo "Starting in FastAPI mode..."
GRADIO_SERVER_NAME=${GRADIO_SERVER_NAME:-0.0.0.0}
GRADIO_SERVER_PORT=${GRADIO_SERVER_PORT:-7860}
# Start uvicorn server.
echo "Starting with Uvicorn on $GRADIO_SERVER_NAME:$GRADIO_SERVER_PORT"
exec uvicorn app:app \
--host $GRADIO_SERVER_NAME \
--port $GRADIO_SERVER_PORT \
--proxy-headers
else
echo "Starting in Gradio mode..."
exec python app.py
fi
fi |