Spaces:
Runtime error
Runtime error
# run.py | |
import subprocess | |
import sys | |
import os | |
def main(): | |
# Start Streamlit server only | |
port = int(os.environ.get("PORT", 7860)) # Hugging Face Spaces uses port 7860 | |
streamlit_process = subprocess.Popen([ | |
sys.executable, | |
"-m", | |
"streamlit", | |
"run", | |
"app.py", | |
"--server.port", | |
str(port), | |
"--server.address", | |
"0.0.0.0" | |
]) | |
try: | |
streamlit_process.wait() | |
except KeyboardInterrupt: | |
streamlit_process.terminate() | |
if __name__ == "__main__": | |
main() |