Spaces:
Runtime error
Runtime error
File size: 539 Bytes
1715097 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# 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() |