Spaces:
Runtime error
Runtime error
# run.py | |
import subprocess | |
import sys | |
def main(): | |
# Start FastAPI server | |
api_process = subprocess.Popen([sys.executable, "-m", "uvicorn", "api:app", "--host", "0.0.0.0", "--port", "8000"]) | |
# Start Streamlit server | |
streamlit_process = subprocess.Popen([sys.executable, "-m", "streamlit", "run", "app.py"]) | |
try: | |
api_process.wait() | |
streamlit_process.wait() | |
except KeyboardInterrupt: | |
api_process.terminate() | |
streamlit_process.terminate() | |
if __name__ == "__main__": | |
main() |