boffire commited on
Commit
33261a8
·
verified ·
1 Parent(s): ccb5dad

Update start.sh

Browse files
Files changed (1) hide show
  1. start.sh +15 -10
start.sh CHANGED
@@ -1,22 +1,27 @@
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
 
 
 
 
 
 
 
 
 
1
  #!/bin/bash
2
  set -e
3
 
4
+ # 1. Start LibreTranslate internally (not reachable from outside)
5
+ /app/venv/bin/libretranslate &
 
 
 
6
  LT_PID=$!
7
 
8
+ # 2. Wait until it responds
9
+ echo "Waiting for LibreTranslate..."
10
  for i in {1..30}; do
11
  if curl -s http://127.0.0.1:5000/ >/dev/null 2>&1; then
12
+ echo "LibreTranslate ready on port 5000"
13
  break
14
  fi
 
15
  sleep 2
16
  done
17
 
18
+ # 3. Keep your suggestion uploader running in the background
19
+ (
20
+ while true; do
21
+ /app/venv/bin/python3 /app/upload_suggestions.py
22
+ sleep 60
23
+ done
24
+ ) &
25
+
26
+ # 4. Public-facing proxy on HF Spaces port 7860
27
+ cd /app && exec /app/venv/bin/uvicorn proxy:app --host 0.0.0.0 --port 7860