Update app.py
Browse files
app.py
CHANGED
@@ -2,7 +2,7 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
"""
|
5 |
-
|
6 |
"""
|
7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
8 |
|
@@ -41,20 +41,20 @@ def respond(
|
|
41 |
|
42 |
|
43 |
"""
|
44 |
-
|
45 |
"""
|
46 |
demo = gr.ChatInterface(
|
47 |
respond,
|
48 |
additional_inputs=[
|
49 |
-
gr.Textbox(value="
|
50 |
-
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="
|
51 |
-
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
|
52 |
gr.Slider(
|
53 |
minimum=0.1,
|
54 |
maximum=1.0,
|
55 |
value=0.95,
|
56 |
step=0.05,
|
57 |
-
label="Top-p (
|
58 |
),
|
59 |
],
|
60 |
)
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
|
4 |
"""
|
5 |
+
更多關於 `huggingface_hub` Inference API 支援的資訊,請參閱文件:https://huggingface.co/docs/huggingface_hub/v0.22.2/en/guides/inference
|
6 |
"""
|
7 |
client = InferenceClient("HuggingFaceH4/zephyr-7b-beta")
|
8 |
|
|
|
41 |
|
42 |
|
43 |
"""
|
44 |
+
如果需要自訂 ChatInterface,請參考 gradio 文件:https://www.gradio.app/docs/chatinterface
|
45 |
"""
|
46 |
demo = gr.ChatInterface(
|
47 |
respond,
|
48 |
additional_inputs=[
|
49 |
+
gr.Textbox(value="你是一個友善的聊天機器人。", label="系統訊息"),
|
50 |
+
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="最大新生成字元數"),
|
51 |
+
gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="溫度 (Temperature)"),
|
52 |
gr.Slider(
|
53 |
minimum=0.1,
|
54 |
maximum=1.0,
|
55 |
value=0.95,
|
56 |
step=0.05,
|
57 |
+
label="Top-p (核採樣)",
|
58 |
),
|
59 |
],
|
60 |
)
|