Spaces:
Running
Running
File size: 719 Bytes
c760ee6 ada402f 33261a8 c760ee6 33261a8 ada402f c760ee6 ada402f c760ee6 ada402f c760ee6 33261a8 ada402f | 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 26 27 28 29 | #!/bin/bash
set -e
# 1. Start LibreTranslate internally (env vars LT_HOST/LT_PORT are already set)
/app/venv/bin/libretranslate &
LT_PID=$!
# 2. Wait until it responds
echo "Waiting for LibreTranslate on 127.0.0.1:5000..."
for i in {1..30}; do
if curl -s http://127.0.0.1:5000/ >/dev/null 2>&1; then
echo "LibreTranslate ready"
break
fi
echo " ... retry $i/30"
sleep 2
done
# 3. Keep your suggestion uploader running in the background
(
while true; do
/app/venv/bin/python3 /app/upload_suggestions.py
sleep 60
done
) &
# 4. Start the public-facing proxy (this is the foreground process)
cd /app
exec /app/venv/bin/uvicorn proxy:app --host 0.0.0.0 --port 7860 |