Spaces:
Running
on
Zero
Running
on
Zero
LOG_SERVER_PORT=9929 | |
export LOG_SERVER="http://0.0.0.0:${LOG_SERVER_PORT}" | |
export LOG_SERVER_SUBDOMAIN="" | |
export LOGDIR="tmp_log/" | |
export SERVER_PORT=10201 # gradio server port | |
# start log server | |
uvicorn serve.log_server:app --reload --port ${LOG_SERVER_PORT} --host 0.0.0.0 & | |
PID1=$! | |
# start gradio server | |
python app.py & | |
PID2=$! | |
# Function to kill the background jobs if this script is terminated | |
cleanup() { | |
echo "Cleaning up..." | |
kill $PID1 $PID2 | |
exit 0 | |
} | |
# Trap SIGINT (Ctrl+C) and SIGTERM signals and call cleanup function | |
trap cleanup SIGINT SIGTERM | |
# Wait for both background processes to finish | |
wait $PID1 | |
wait $PID2 |