Spaces:
Sleeping
Sleeping
更清朗的UI
Browse files
main.py
CHANGED
@@ -57,24 +57,38 @@ with gr.Blocks(theme=set_theme, analytics_enabled=False) as demo:
|
|
57 |
with gr.Row():
|
58 |
from check_proxy import check_proxy
|
59 |
statusDisplay = gr.Markdown(f"Tip: 按Enter提交, 按Shift+Enter换行。当前模型: {LLM_MODEL} \n {check_proxy(proxies)}")
|
60 |
-
with gr.
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
with gr.Accordion("
|
|
|
76 |
top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.01,interactive=True, label="Top-p (nucleus sampling)",)
|
77 |
temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0, step=0.01, interactive=True, label="Temperature",)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
predict_args = dict(fn=predict, inputs=[txt, top_p, temperature, chatbot, history, system_prompt], outputs=[chatbot, history, statusDisplay], show_progress=True)
|
80 |
empty_txt_args = dict(fn=lambda: "", inputs=[], outputs=[txt]) # 用于在提交后清空输入栏
|
|
|
57 |
with gr.Row():
|
58 |
from check_proxy import check_proxy
|
59 |
statusDisplay = gr.Markdown(f"Tip: 按Enter提交, 按Shift+Enter换行。当前模型: {LLM_MODEL} \n {check_proxy(proxies)}")
|
60 |
+
with gr.Accordion("基础功能区", open=True):
|
61 |
+
with gr.Row():
|
62 |
+
for k in functional:
|
63 |
+
variant = functional[k]["Color"] if "Color" in functional[k] else "secondary"
|
64 |
+
functional[k]["Button"] = gr.Button(k, variant=variant)
|
65 |
+
with gr.Accordion("函数插件区", open=True):
|
66 |
+
with gr.Row():
|
67 |
+
gr.Markdown("注意:以下“红颜色”标识的函数插件需从input区读取路径作为参数.")
|
68 |
+
with gr.Row():
|
69 |
+
for k in crazy_functional:
|
70 |
+
variant = crazy_functional[k]["Color"] if "Color" in crazy_functional[k] else "secondary"
|
71 |
+
crazy_functional[k]["Button"] = gr.Button(k, variant=variant)
|
72 |
+
with gr.Row():
|
73 |
+
with gr.Accordion("展开“文件上传区”。上传本地文件供“红颜色”的函数插件调用。", open=False):
|
74 |
+
file_upload = gr.Files(label='任何文件, 但推荐上传压缩文件(zip, tar)', file_count="multiple")
|
75 |
+
with gr.Accordion("展开SysPrompt & GPT参数 & 交互界面布局", open=False):
|
76 |
+
system_prompt = gr.Textbox(show_label=True, placeholder=f"System Prompt", label="System prompt", value=initial_prompt)
|
77 |
top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.01,interactive=True, label="Top-p (nucleus sampling)",)
|
78 |
temperature = gr.Slider(minimum=-0, maximum=2.0, value=1.0, step=0.01, interactive=True, label="Temperature",)
|
79 |
+
checkboxes = gr.CheckboxGroup(["基础功能区", "函数插件区", "文件上传区"], value=["USA", "Japan", "Pakistan"],
|
80 |
+
label="显示功能区")
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
def what_is_this(a):
|
85 |
+
return a
|
86 |
+
|
87 |
+
checkboxes.select(what_is_this, [checkboxes], [checkboxes])
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
|
93 |
predict_args = dict(fn=predict, inputs=[txt, top_p, temperature, chatbot, history, system_prompt], outputs=[chatbot, history, statusDisplay], show_progress=True)
|
94 |
empty_txt_args = dict(fn=lambda: "", inputs=[], outputs=[txt]) # 用于在提交后清空输入栏
|