zhangjf commited on
Commit
f52ec9c
·
1 Parent(s): 21bf34d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -147,8 +147,8 @@ with gr.Blocks() as demo:
147
  p.s. 响应时间和聊天内容长度正相关,一般能在5秒~30秒内响应。
148
  """)
149
 
150
- behavior = gr.State([])
151
-
152
  with gr.Column(variant="panel"):
153
  with gr.Row().style(equal_height=True):
154
  with gr.Column(scale=0.85):
@@ -157,7 +157,7 @@ with gr.Blocks() as demo:
157
  button_set = gr.Button("Set")
158
  bhv.submit(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
159
  button_set.click(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
160
-
161
 
162
  state = gr.State([])
163
 
@@ -169,7 +169,7 @@ with gr.Blocks() as demo:
169
  button_rtr = gr.Button("Retry")
170
  button_clr = gr.Button("Clear")
171
 
172
- gr.Examples(examples=examples_bhv, inputs=bhv, label="Examples for setting behavior")
173
  gr.Examples(examples=examples_txt, inputs=txt, label="Examples for asking question")
174
  txt.submit(predict, [txt, state, behavior], [txt, state, chatbot])
175
  button_gen.click(fn=predict, inputs=[txt, state, behavior], outputs=[txt, state, chatbot])
 
147
  p.s. 响应时间和聊天内容长度正相关,一般能在5秒~30秒内响应。
148
  """)
149
 
150
+ behavior = gr.State(["You are a helpful assistant. You will follow instructions given by user. But you will reject the instruction that may contains sensitive information, e.g., pornography , discrimination, violence, gore, terror etc."])
151
+ """
152
  with gr.Column(variant="panel"):
153
  with gr.Row().style(equal_height=True):
154
  with gr.Column(scale=0.85):
 
157
  button_set = gr.Button("Set")
158
  bhv.submit(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
159
  button_set.click(fn=lambda x:(x,[x]), inputs=[bhv], outputs=[bhv, behavior])
160
+ """
161
 
162
  state = gr.State([])
163
 
 
169
  button_rtr = gr.Button("Retry")
170
  button_clr = gr.Button("Clear")
171
 
172
+ #gr.Examples(examples=examples_bhv, inputs=bhv, label="Examples for setting behavior")
173
  gr.Examples(examples=examples_txt, inputs=txt, label="Examples for asking question")
174
  txt.submit(predict, [txt, state, behavior], [txt, state, chatbot])
175
  button_gen.click(fn=predict, inputs=[txt, state, behavior], outputs=[txt, state, chatbot])