boffire commited on
Commit
c760ee6
·
verified ·
1 Parent(s): eaad188

Create start.sh

Browse files
Files changed (1) hide show
  1. start.sh +22 -0
start.sh ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ export LT_SUGGESTIONS=true
5
+
6
+ # 1. Start LibreTranslate internally (not exposed publicly)
7
+ libretranslate --host 127.0.0.1 --port 5000 &
8
+
9
+ LT_PID=$!
10
+
11
+ # 2. Wait until it is healthy
12
+ for i in {1..30}; do
13
+ if curl -s http://127.0.0.1:5000/ >/dev/null 2>&1; then
14
+ echo "LibreTranslate ready"
15
+ break
16
+ fi
17
+ echo "Waiting for LibreTranslate... ($i/30)"
18
+ sleep 2
19
+ done
20
+
21
+ # 3. Start the public proxy on HF Spaces port 7860
22
+ exec python /app/proxy.py