Tuchuanhuhuhu commited on
Commit
e22b7aa
1 Parent(s): d7ec937

微调界面

Browse files
Files changed (1) hide show
  1. ChuanhuChatbot.py +42 -42
ChuanhuChatbot.py CHANGED
@@ -51,9 +51,10 @@ with gr.Blocks(css=customCSS,) as demo:
51
  FALSECONSTANT = gr.State(False)
52
  topic = gr.State("未命名对话历史记录")
53
 
54
- gr.HTML("""
55
- <div style="text-align: center; margin-top: 20px;">
56
- """)
 
57
 
58
  with gr.Row(scale=1).style(equal_height=True):
59
 
@@ -76,46 +77,45 @@ with gr.Blocks(css=customCSS,) as demo:
76
 
77
  with gr.Column():
78
  with gr.Row(min_width=50,scale=1):
79
- gr.HTML(title)
80
  status_display = gr.Markdown("status: ready")
81
- keyTxt = gr.Textbox(show_label=True, placeholder=f"OpenAI API-key...",value=my_api_key, type="password", visible=not HIDE_MY_KEY, label="API-Key")
82
- model_select_dropdown = gr.Dropdown(label="选择模型", choices=MODELS, multiselect=False, value=MODELS[0])
83
- systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入System Prompt...", label="System prompt", value=initial_prompt).style(container=True)
84
-
85
-
86
- with gr.Accordion(label="加载Prompt模板", open=False):
87
- with gr.Column():
88
- with gr.Row():
89
- with gr.Column(scale=6):
90
- templateFileSelectDropdown = gr.Dropdown(label="选择Prompt模板集合文件", choices=get_template_names(plain=True), multiselect=False, value=get_template_names(plain=True)[0])
91
- with gr.Column(scale=1):
92
- templateRefreshBtn = gr.Button("🔄 刷新")
93
- with gr.Row():
94
- with gr.Column():
95
- templateSelectDropdown = gr.Dropdown(label="从Prompt模板中加载", choices=load_template(get_template_names(plain=True)[0], mode=1), multiselect=False, value=load_template(get_template_names(plain=True)[0], mode=1)[0])
96
- with gr.Accordion(label="保存/加载对话历史记录", open=False):
97
- with gr.Column():
98
- with gr.Row():
99
- with gr.Column(scale=6):
100
- saveFileName = gr.Textbox(
101
- show_label=True, placeholder=f"在这里输入保存的文件名...", label="设置保存文件名", value="对话历史记录").style(container=True)
102
- with gr.Column(scale=1):
103
- saveHistoryBtn = gr.Button("💾 保存对话")
104
- with gr.Row():
105
- with gr.Column(scale=6):
106
- historyFileSelectDropdown = gr.Dropdown(label="从列表中加载对话", choices=get_history_names(plain=True), multiselect=False, value=get_history_names(plain=True)[0])
107
- with gr.Column(scale=1):
108
- historyRefreshBtn = gr.Button("🔄 刷新")
109
-
110
- use_streaming_checkbox = gr.Checkbox(label="实时传输回答", value=True, visible=enable_streaming_option)
111
- use_websearch_checkbox = gr.Checkbox(label="使用在线搜索", value=False)
112
-
113
-
114
- with gr.Accordion("参数", open=False):
115
- top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.05,
116
- interactive=True, label="Top-p (nucleus sampling)",)
117
- temperature = gr.Slider(minimum=-0, maximum=5.0, value=1.0,
118
- step=0.1, interactive=True, label="Temperature",)
119
 
120
 
121
 
 
51
  FALSECONSTANT = gr.State(False)
52
  topic = gr.State("未命名对话历史记录")
53
 
54
+ # gr.HTML("""
55
+ # <div style="text-align: center; margin-top: 20px;">
56
+ # """)
57
+ gr.HTML(title)
58
 
59
  with gr.Row(scale=1).style(equal_height=True):
60
 
 
77
 
78
  with gr.Column():
79
  with gr.Row(min_width=50,scale=1):
 
80
  status_display = gr.Markdown("status: ready")
81
+ with gr.Tab(label="ChatGPT"):
82
+ keyTxt = gr.Textbox(show_label=True, placeholder=f"OpenAI API-key...",value=my_api_key, type="password", visible=not HIDE_MY_KEY, label="API-Key")
83
+ model_select_dropdown = gr.Dropdown(label="选择模型", choices=MODELS, multiselect=False, value=MODELS[0])
84
+ with gr.Accordion("参数", open=False):
85
+ top_p = gr.Slider(minimum=-0, maximum=1.0, value=1.0, step=0.05,
86
+ interactive=True, label="Top-p (nucleus sampling)",)
87
+ temperature = gr.Slider(minimum=-0, maximum=5.0, value=1.0,
88
+ step=0.1, interactive=True, label="Temperature",)
89
+ use_streaming_checkbox = gr.Checkbox(label="实时传输回答", value=True, visible=enable_streaming_option)
90
+ use_websearch_checkbox = gr.Checkbox(label="使用在线搜索", value=False)
91
+
92
+ with gr.Tab(label="Prompt"):
93
+ systemPromptTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入System Prompt...", label="System prompt", value=initial_prompt).style(container=True)
94
+ with gr.Accordion(label="加载Prompt模板", open=True):
95
+ with gr.Column():
96
+ with gr.Row():
97
+ with gr.Column(scale=6):
98
+ templateFileSelectDropdown = gr.Dropdown(label="选择Prompt模板集合文件", choices=get_template_names(plain=True), multiselect=False, value=get_template_names(plain=True)[0])
99
+ with gr.Column(scale=1):
100
+ templateRefreshBtn = gr.Button("🔄 刷新")
101
+ with gr.Row():
102
+ with gr.Column():
103
+ templateSelectDropdown = gr.Dropdown(label="从Prompt模板中加载", choices=load_template(get_template_names(plain=True)[0], mode=1), multiselect=False, value=load_template(get_template_names(plain=True)[0], mode=1)[0])
104
+
105
+ with gr.Tab(label="保存/加载"):
106
+ with gr.Accordion(label="保存/加载对话历史记录", open=True):
107
+ with gr.Column():
108
+ with gr.Row():
109
+ with gr.Column(scale=6):
110
+ saveFileName = gr.Textbox(
111
+ show_label=True, placeholder=f"在这里输入保存的文件名...", label="设置保存文件名", value="对话历史记录").style(container=True)
112
+ with gr.Column(scale=1):
113
+ saveHistoryBtn = gr.Button("💾 保存对话")
114
+ with gr.Row():
115
+ with gr.Column(scale=6):
116
+ historyFileSelectDropdown = gr.Dropdown(label="从列表中加载对话", choices=get_history_names(plain=True), multiselect=False, value=get_history_names(plain=True)[0])
117
+ with gr.Column(scale=1):
118
+ historyRefreshBtn = gr.Button("🔄 刷新")
119
 
120
 
121