Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
from keep_alive import keep_alive
|
|
|
|
|
|
|
|
|
|
| 4 |
"""
|
| 5 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 6 |
"""
|
|
@@ -62,5 +65,12 @@ def main():
|
|
| 62 |
keep_alive(urls)
|
| 63 |
|
| 64 |
if __name__ == "__main__":
|
| 65 |
-
|
| 66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import InferenceClient
|
| 3 |
from keep_alive import keep_alive
|
| 4 |
+
import multiprocessing
|
| 5 |
+
import threading
|
| 6 |
+
import time
|
| 7 |
"""
|
| 8 |
For more information on `huggingface_hub` Inference API support, please check the docs: https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
| 9 |
"""
|
|
|
|
| 65 |
keep_alive(urls)
|
| 66 |
|
| 67 |
if __name__ == "__main__":
|
| 68 |
+
# 創建兩個進程
|
| 69 |
+
p1 = multiprocessing.Process(target=main)
|
| 70 |
+
p2 = multiprocessing.Process(target=respond)
|
| 71 |
+
|
| 72 |
+
p1.start()
|
| 73 |
+
p2.start()
|
| 74 |
+
|
| 75 |
+
p1.join()
|
| 76 |
+
p2.join()
|