File size: 640 Bytes
ea4fcea
 
134a09c
488bb70
ea4fcea
488bb70
 
ea4fcea
134a09c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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