zhangjf commited on
Commit
24aec20
·
1 Parent(s): aac6381

Polish design

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -101,8 +101,9 @@ with gr.Blocks() as demo:
101
  ]
102
 
103
  examples_bhv = [
104
- "你现在是一位贴心的心理咨询师,会为我提供耐心的解答。",
105
- "你现在是一名无神论者,不信奉任何宗教。",
 
106
  f"You are a helpful assistant. Today is {datetime.date.today()}.",
107
  ]
108
 
@@ -110,9 +111,9 @@ with gr.Blocks() as demo:
110
  """
111
  朋友你好,
112
 
113
- 这是我利用[gradio](https://gradio.app/creating-a-chatbot/)编写的一个小网页,用于以网页的形式给大家分享ChatGPT请求服务,希望你玩的开心
114
 
115
- p.s. 响应时间和问题复杂程度相关,<del>一般能在10~20秒内出结果</del>用了新的api已经提速到大约5秒内了
116
  """)
117
 
118
  behavior = gr.State([])
@@ -123,7 +124,6 @@ with gr.Blocks() as demo:
123
  bhv = gr.Textbox(show_label=False, placeholder="输入你想让ChatGPT扮演的人设").style(container=False)
124
  with gr.Column(scale=0.15, min_width=0):
125
  button_set = gr.Button("Set")
126
- gr.Examples(examples=examples_bhv, inputs=bhv)
127
  bhv.submit(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
128
  button_set.click(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
129
 
@@ -136,7 +136,9 @@ with gr.Blocks() as demo:
136
  with gr.Row():
137
  button_gen = gr.Button("Submit")
138
  button_clr = gr.Button("Clear")
139
- gr.Examples(examples=examples_txt, inputs=txt)
 
 
140
  txt.submit(predict, [txt, state, behavior], [txt, state, chatbot])
141
  button_gen.click(fn=predict, inputs=[txt, state, behavior], outputs=[txt, state, chatbot])
142
  button_clr.click(fn=lambda :([],[]), inputs=None, outputs=[chatbot, state])
 
101
  ]
102
 
103
  examples_bhv = [
104
+ "你现在是一个带有批判思维的导游,会对景点的优缺点进行中肯的分析。",
105
+ "你现在是一名佛教信仰者,但同时又对世界上其它的宗教和文化保持着包容、尊重和交流的态度。",
106
+ f"You are a helpful assistant. You will answer all the questions step-by-step.",
107
  f"You are a helpful assistant. Today is {datetime.date.today()}.",
108
  ]
109
 
 
111
  """
112
  朋友你好,
113
 
114
+ 这是我利用[gradio](https://gradio.app/creating-a-chatbot/)编写的一个小网页,用于以网页的形式给大家分享ChatGPT请求服务,希望你玩的开心。关于使用技巧或学术研讨,欢迎在[Community](https://huggingface.co/spaces/zhangjf/chatbot/discussions)中和我交流。
115
 
116
+ p.s. 响应时间和聊天内容长度正相关,一般能在5秒~30秒内响应。
117
  """)
118
 
119
  behavior = gr.State([])
 
124
  bhv = gr.Textbox(show_label=False, placeholder="输入你想让ChatGPT扮演的人设").style(container=False)
125
  with gr.Column(scale=0.15, min_width=0):
126
  button_set = gr.Button("Set")
 
127
  bhv.submit(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
128
  button_set.click(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
129
 
 
136
  with gr.Row():
137
  button_gen = gr.Button("Submit")
138
  button_clr = gr.Button("Clear")
139
+
140
+ gr.Examples(examples=examples_bhv, inputs=bhv, label="Examples for setting behavior")
141
+ gr.Examples(examples=examples_txt, inputs=txt, label="Examples for asking question")
142
  txt.submit(predict, [txt, state, behavior], [txt, state, chatbot])
143
  button_gen.click(fn=predict, inputs=[txt, state, behavior], outputs=[txt, state, chatbot])
144
  button_clr.click(fn=lambda :([],[]), inputs=None, outputs=[chatbot, state])