#!/bin/bash # Start the API, the Streamlit demo and nginx in front of both. If any of the # three exits, exit too, so the Space restarts the container instead of # serving half an app. uvicorn src.api:app --host 127.0.0.1 --port 8001 & # XSRF and CORS checks off: the Space serves the app inside an iframe on # huggingface.co, where Streamlit's XSRF cookie is blocked and uploads 403. streamlit run app.py \ --server.address 127.0.0.1 --server.port 8501 --server.headless true \ --server.enableXsrfProtection false --server.enableCORS false \ --browser.gatherUsageStats false & nginx -c "$HOME/app/nginx.conf" -e stderr -g 'daemon off;' & wait -n exit 1