Spaces:
Running
Running
muralipala1504 commited on
Commit ·
162d479
1
Parent(s): 505d1aa
Add Python launcher script for seamless backend start
Browse files- run_deepshell.py +22 -0
run_deepshell.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import subprocess
|
| 2 |
+
import sys
|
| 3 |
+
import os
|
| 4 |
+
import signal
|
| 5 |
+
|
| 6 |
+
def start_backend():
|
| 7 |
+
cmd = [sys.executable, os.path.join("deepshell-backend", "wrapper.py")]
|
| 8 |
+
process = subprocess.Popen(cmd)
|
| 9 |
+
print(f"DeepShell backend started with PID {process.pid}")
|
| 10 |
+
return process
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
backend_process = start_backend()
|
| 14 |
+
try:
|
| 15 |
+
backend_process.wait()
|
| 16 |
+
except KeyboardInterrupt:
|
| 17 |
+
print("Stopping DeepShell backend...")
|
| 18 |
+
backend_process.send_signal(signal.SIGINT)
|
| 19 |
+
backend_process.wait()
|
| 20 |
+
|
| 21 |
+
if __name__ == "__main__":
|
| 22 |
+
main()
|