Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,13 +15,11 @@ if not os.path.exists(model_path):
|
|
15 |
# ウェブUIの起動
|
16 |
import gradio as gr
|
17 |
import copy
|
18 |
-
import time
|
19 |
from llama_cpp import Llama
|
20 |
|
21 |
llm = Llama(
|
22 |
model_path=model_path,
|
23 |
n_ctx=2048,
|
24 |
-
# n_gpu_layers=100, # CPUで実行する場合は削除
|
25 |
)
|
26 |
|
27 |
history = []
|
@@ -57,19 +55,20 @@ def generate_text(message, history):
|
|
57 |
yield temp
|
58 |
|
59 |
history.append((message, temp))
|
60 |
-
|
61 |
|
62 |
demo = gr.ChatInterface(
|
63 |
-
generate_text,
|
64 |
title="ZhongJingGPT-V2-1_8B-GGUF chatbot using llama-cpp-python",
|
65 |
-
description="",
|
66 |
-
examples=["我发热,咳嗽,咽痛,该怎么办"],
|
67 |
cache_examples=True,
|
68 |
retry_btn=None,
|
69 |
undo_btn="Remove last",
|
70 |
clear_btn="Clear all",
|
71 |
)
|
72 |
-
|
73 |
-
demo.
|
|
|
74 |
|
75 |
|
|
|
15 |
# ウェブUIの起動
|
16 |
import gradio as gr
|
17 |
import copy
|
|
|
18 |
from llama_cpp import Llama
|
19 |
|
20 |
llm = Llama(
|
21 |
model_path=model_path,
|
22 |
n_ctx=2048,
|
|
|
23 |
)
|
24 |
|
25 |
history = []
|
|
|
55 |
yield temp
|
56 |
|
57 |
history.append((message, temp))
|
58 |
+
return history
|
59 |
|
60 |
demo = gr.ChatInterface(
|
61 |
+
fn=lambda message, history: generate_text(message, history),
|
62 |
title="ZhongJingGPT-V2-1_8B-GGUF chatbot using llama-cpp-python",
|
63 |
+
description="This is a TCM medical assistant chatbot.",
|
64 |
+
examples=[("我发热,咳嗽,咽痛,该怎么办",)],
|
65 |
cache_examples=True,
|
66 |
retry_btn=None,
|
67 |
undo_btn="Remove last",
|
68 |
clear_btn="Clear all",
|
69 |
)
|
70 |
+
|
71 |
+
demo.queue(concurrency_limit=1) # 修改为 concurrency_limit
|
72 |
+
demo.launch(debug=True, share=True, max_threads=1) # 添加 max_threads 参数
|
73 |
|
74 |
|