jdenis-insn commited on
Commit ·
6407f0e
1
Parent(s): edaaf03
add start file
Browse files
start.py
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import multiprocessing
|
| 2 |
+
import subprocess
|
| 3 |
+
import os
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
def start_backend():
|
| 7 |
+
os.chdir("/home/user/app/backend")
|
| 8 |
+
subprocess.run(["uv", "sync"])
|
| 9 |
+
subprocess.run(
|
| 10 |
+
["uv", "run", "fastapi", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
def start_frontend():
|
| 15 |
+
os.chdir("/home/user/app/frontend")
|
| 16 |
+
subprocess.run(["uv", "sync"])
|
| 17 |
+
subprocess.run(
|
| 18 |
+
[
|
| 19 |
+
"uv",
|
| 20 |
+
"run",
|
| 21 |
+
"streamlit",
|
| 22 |
+
"run",
|
| 23 |
+
"app/main.py",
|
| 24 |
+
"--server.port",
|
| 25 |
+
"8501",
|
| 26 |
+
"--server.address",
|
| 27 |
+
"0.0.0.0",
|
| 28 |
+
]
|
| 29 |
+
)
|
| 30 |
+
|
| 31 |
+
|
| 32 |
+
def main():
|
| 33 |
+
backend_process = multiprocessing.Process(target=start_backend)
|
| 34 |
+
frontend_process = multiprocessing.Process(target=start_frontend)
|
| 35 |
+
|
| 36 |
+
backend_process.start()
|
| 37 |
+
frontend_process.start()
|
| 38 |
+
|
| 39 |
+
backend_process.join()
|
| 40 |
+
frontend_process.join()
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
if __name__ == "__main__":
|
| 44 |
+
main()
|