add sleep code
Browse files
app.py
CHANGED
|
@@ -1,22 +1,22 @@
|
|
| 1 |
import subprocess
|
| 2 |
-
import gradio as gr
|
| 3 |
import time
|
| 4 |
|
| 5 |
def start_controller():
|
| 6 |
subprocess.Popen(['python', '-m', 'llava.serve.controller', '--host', '0.0.0.0', '--port', '10000'])
|
| 7 |
-
time.sleep(
|
| 8 |
-
|
| 9 |
|
| 10 |
def start_gradio_web_server():
|
| 11 |
subprocess.Popen(['python', '-m', 'llava.serve.gradio_web_server', '--controller', 'http://localhost:10000', '--model-list-mode', 'reload'])
|
| 12 |
-
time.sleep(
|
| 13 |
|
| 14 |
def start_model_worker():
|
| 15 |
subprocess.Popen(['python', '-m', 'llava.serve.model_worker', '--host', '0.0.0.0', '--controller', 'http://localhost:10000', '--port', '40000', '--worker', 'http://localhost:40000', '--model-path', 'liuhaotian/llava-v1.5-13b'])
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
| 19 |
if __name__ == "__main__":
|
| 20 |
-
start_controller()
|
| 21 |
-
start_gradio_web_server()
|
| 22 |
-
start_model_worker()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import subprocess
|
|
|
|
| 2 |
import time
|
| 3 |
|
| 4 |
def start_controller():
|
| 5 |
subprocess.Popen(['python', '-m', 'llava.serve.controller', '--host', '0.0.0.0', '--port', '10000'])
|
| 6 |
+
time.sleep(10) # wait for the controller to start
|
|
|
|
| 7 |
|
| 8 |
def start_gradio_web_server():
|
| 9 |
subprocess.Popen(['python', '-m', 'llava.serve.gradio_web_server', '--controller', 'http://localhost:10000', '--model-list-mode', 'reload'])
|
| 10 |
+
time.sleep(10) # wait for the web server to start
|
| 11 |
|
| 12 |
def start_model_worker():
|
| 13 |
subprocess.Popen(['python', '-m', 'llava.serve.model_worker', '--host', '0.0.0.0', '--controller', 'http://localhost:10000', '--port', '40000', '--worker', 'http://localhost:40000', '--model-path', 'liuhaotian/llava-v1.5-13b'])
|
| 14 |
|
|
|
|
|
|
|
| 15 |
if __name__ == "__main__":
|
| 16 |
+
start_controller() # Starts the controller process
|
| 17 |
+
start_gradio_web_server() # Starts the Gradio web server process
|
| 18 |
+
start_model_worker() # Starts the model worker process
|
| 19 |
+
|
| 20 |
+
# Keep the script running to maintain the subprocesses alive
|
| 21 |
+
while True:
|
| 22 |
+
time.sleep(3600) # Sleep for 1 hour, adjust as needed
|