MBG0903's picture
Create app.py
0d36d3e verified
Raw
History Blame Contribute Delete
605 Bytes
import os
import sys
from streamlit.web import cli as stcli
# Hugging Face Spaces expects apps to listen on port 7860.
os.environ.setdefault("STREAMLIT_SERVER_PORT", "7860")
os.environ.setdefault("STREAMLIT_SERVER_ADDRESS", "0.0.0.0")
# Your actual Streamlit app is inside src/streamlit_app.py
APP_FILE = "src/streamlit_app.py"
if __name__ == "__main__":
sys.argv = [
"streamlit",
"run",
APP_FILE,
"--server.port=7860",
"--server.address=0.0.0.0",
"--server.headless=true",
"--browser.gatherUsageStats=false",
]
sys.exit(stcli.main())