Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
134a09c
1
Parent(s):
8dcd2f5
update
Browse files- serve_local.sh +25 -0
serve_local.sh
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# start log server
|
2 |
+
export LOG_SERVER="http://0.0.0.0:9999"
|
3 |
+
export LOG_SERVER_SUBDOMAIN=""
|
4 |
+
uvicorn serve.log_server:app --reload --port 9999 --host 0.0.0.0 &
|
5 |
+
PID1=$!
|
6 |
+
# start gradio server
|
7 |
+
|
8 |
+
export LOG_DIR="tmp_log/"
|
9 |
+
export SERVER_PORT=10001 # gradio server port
|
10 |
+
python app.py &
|
11 |
+
PID2=$!
|
12 |
+
|
13 |
+
# Function to kill the background jobs if this script is terminated
|
14 |
+
cleanup() {
|
15 |
+
echo "Cleaning up..."
|
16 |
+
kill $PID1 $PID2
|
17 |
+
exit 0
|
18 |
+
}
|
19 |
+
|
20 |
+
# Trap SIGINT (Ctrl+C) and SIGTERM signals and call cleanup function
|
21 |
+
trap cleanup SIGINT SIGTERM
|
22 |
+
|
23 |
+
# Wait for both background processes to finish
|
24 |
+
wait $PID1
|
25 |
+
wait $PID2
|