Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Dev launcher: starts FastAPI WS server (uvicorn) on 5001 and Streamlit app on 5050. | |
| """ | |
| import subprocess, sys, time, os | |
| def main(): | |
| env = os.environ.copy() | |
| env.setdefault("SYNC_SERVER_BASE", "http://localhost:5001") | |
| ws = subprocess.Popen([sys.executable, "-m", "uvicorn", "ws_server:app", "--host", "0.0.0.0", "--port", "5001"], env=env) | |
| time.sleep(1.5) | |
| try: | |
| st = subprocess.Popen([sys.executable, "-m", "streamlit", "run", "app.py", "--server.port", "5050", "--server.address", "localhost"], env=env) | |
| st.wait() | |
| finally: | |
| ws.terminate() | |
| if __name__ == "__main__": | |
| main() | |