| set -e | |
| # Start Grobid in the background | |
| echo "Starting Grobid service..." | |
| (cd /opt/grobid && ./grobid-service/bin/grobid-service) & | |
| # Wait for Grobid to be ready | |
| echo "Waiting for Grobid to launch on port 8070..." | |
| # Using python to check connection, suppressing output to avoid noisy tracebacks | |
| timeout 60s bash -c 'until python3 -c "import urllib.request; urllib.request.urlopen(\"http://localhost:8070/api/isalive\")" > /dev/null 2>&1; do echo "Waiting for Grobid..."; sleep 5; done' | |
| echo "Grobid is alive!" | |
| # Start the Gradio app | |
| python3 app.py | |