Spaces:
Running
on
Zero
Running
on
Zero
# start log server | |
export LOG_SERVER="http://0.0.0.0:9999" | |
export LOG_SERVER_SUBDOMAIN="" | |
uvicorn serve.log_server:app --reload --port 9999 --host 0.0.0.0 & | |
PID1=$! | |
# start gradio server | |
export LOG_DIR="tmp_log/" | |
export SERVER_PORT=10001 # gradio server port | |
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 |