Spaces:
Building
Building
Delete start.sh
Browse files
start.sh
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
set -e
|
3 |
-
|
4 |
-
# Function to log messages with timestamp
|
5 |
-
log() {
|
6 |
-
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
|
7 |
-
}
|
8 |
-
|
9 |
-
# Function to check if a service is up
|
10 |
-
wait_for_service() {
|
11 |
-
local host=$1
|
12 |
-
local port=$2
|
13 |
-
local retries=30
|
14 |
-
local wait=2
|
15 |
-
|
16 |
-
log "Waiting for $host:$port to be available..."
|
17 |
-
|
18 |
-
for ((i=1;i<=retries;i++)); do
|
19 |
-
if nc -z "$host" "$port"; then
|
20 |
-
log "$host:$port is available."
|
21 |
-
return 0
|
22 |
-
else
|
23 |
-
log "Attempt $i/$retries: $host:$port not available. Retrying in $wait seconds..."
|
24 |
-
sleep "$wait"
|
25 |
-
fi
|
26 |
-
done
|
27 |
-
|
28 |
-
log "Error: $host:$port did not become available after $((retries * wait)) seconds."
|
29 |
-
exit 1
|
30 |
-
}
|
31 |
-
|
32 |
-
# Start TorchServe
|
33 |
-
log "Starting TorchServe..."
|
34 |
-
torchserve --start --ncs --ts-config /home/torchserve/model-store
|
35 |
-
|
36 |
-
# Wait until TorchServe is up and running
|
37 |
-
wait_for_service "localhost" 8080
|
38 |
-
|
39 |
-
# Start Gradio app
|
40 |
-
log "Starting Gradio application..."
|
41 |
-
python app.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|