JohnSmith9982 commited on
Commit
e4d2f60
1 Parent(s): f71a765

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -2
app.py CHANGED
@@ -179,8 +179,18 @@ def compose_user(user_input):
179
  def reset_textbox():
180
  return gr.update(value='')
181
 
 
 
182
 
 
 
 
 
 
 
 
183
  with gr.Blocks() as demo:
 
184
  keyTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入你的OpenAI API-key...",
185
  value=my_api_key, label="API Key", type="password").style(container=True)
186
  chatbot = gr.Chatbot() # .style(color_map=("#1D51EE", "#585A5B"))
@@ -224,6 +234,8 @@ with gr.Blocks() as demo:
224
  step=0.1, interactive=True, label="Temperature",)
225
  #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
226
  #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
 
 
227
 
228
  txt.submit(predict, [txt, top_p, temperature, keyTxt,
229
  chatbot, history, systemPromptTxt], [chatbot, history])
@@ -244,5 +256,7 @@ with gr.Blocks() as demo:
244
  refreshBtn.click(get_history_names, None, [uploadDropdown])
245
  uploadBtn.click(load_chat_history, [uploadDropdown], [saveFileName, systemPromptTxt, history, chatbot], show_progress=True)
246
 
247
-
248
- demo.queue().launch(debug=True)
 
 
 
179
  def reset_textbox():
180
  return gr.update(value='')
181
 
182
+ title = """<h1 align="center">川虎ChatGPT 🚀</h1>"""
183
+ description = """<div align=center>
184
 
185
+ 由Bilibili [土川虎虎虎](https://space.bilibili.com/29125536) 开发
186
+
187
+ 访问川虎ChatGPT的 [GitHub项目](https://github.com/GaiZhenbiao/ChuanhuChatGPT) 下载最新版脚本
188
+
189
+ 此App使用 `gpt-3.5-turbo` 大语言模型
190
+ </div>
191
+ """
192
  with gr.Blocks() as demo:
193
+ gr.HTML(title)
194
  keyTxt = gr.Textbox(show_label=True, placeholder=f"在这里输入你的OpenAI API-key...",
195
  value=my_api_key, label="API Key", type="password").style(container=True)
196
  chatbot = gr.Chatbot() # .style(color_map=("#1D51EE", "#585A5B"))
 
234
  step=0.1, interactive=True, label="Temperature",)
235
  #top_k = gr.Slider( minimum=1, maximum=50, value=4, step=1, interactive=True, label="Top-k",)
236
  #repetition_penalty = gr.Slider( minimum=0.1, maximum=3.0, value=1.03, step=0.01, interactive=True, label="Repetition Penalty", )
237
+ gr.Markdown(description)
238
+
239
 
240
  txt.submit(predict, [txt, top_p, temperature, keyTxt,
241
  chatbot, history, systemPromptTxt], [chatbot, history])
 
256
  refreshBtn.click(get_history_names, None, [uploadDropdown])
257
  uploadBtn.click(load_chat_history, [uploadDropdown], [saveFileName, systemPromptTxt, history, chatbot], show_progress=True)
258
 
259
+ print("川虎的温馨提示:访问 http://localhost:7860 查看界面")
260
+ # 默认开启本地服务器,默认可以直接从IP访问,默认不创建公开分享链接
261
+ demo.title = "川虎ChatGPT 🚀"
262
+ demo.queue().launch(server_name="127.0.0.1", server_port=7860, share=False) # 改为 share=True 可以创建公开分享链接