File size: 592 Bytes
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
# 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