Dagfinn1962 commited on
Commit
9fa7c39
1 Parent(s): 76e7966

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +58 -0
app.py CHANGED
@@ -145,4 +145,62 @@ with gr.Blocks(theme='HaleyCH/HaleyCH_Theme') as demo:
145
  elem_classes=["disclaimer"],
146
  )
147
  with gr.Row():
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
 
 
145
  elem_classes=["disclaimer"],
146
  )
147
  with gr.Row():
148
+ gr.Markdown(
149
+ "[Privacy policy](https://gist.github.com/samhavens/c29c68cdcd420a9aa0202d0839876dac)",
150
+ elem_classes=["disclaimer"],
151
+ )
152
+
153
+ submit_event = msg.submit(
154
+ fn=conversation.user_turn,
155
+ inputs=[msg],
156
+ outputs=[msg, chatbot],
157
+ queue=False,
158
+ ).then(
159
+ fn=conversation.bot_turn,
160
+ inputs=[system, chatbot, openai_key],
161
+ outputs=[chatbot],
162
+ keep_in_queue=True, # Change `queue=True` to `keep_in_queue=True`
163
+ )
164
+
165
+ submit_click_event = submit.click(
166
+ fn=conversation.user_turn,
167
+ inputs=[msg],
168
+ outputs=[msg, chatbot],
169
+ queue=False,
170
+ ).then(
171
+ fn=conversation.bot_turn,
172
+ inputs=[system, chatbot, openai_key],
173
+ outputs=[chatbot],
174
+ keep_in_queue=True, # Change `queue=True` to `keep_in_queue=True`
175
+ )
176
+
177
+ stop.click(...)
178
+
179
+ fn=None,
180
+ inputs=None,
181
+ outputs=None,
182
+ cancels=[submit_event, submit_click_event],
183
+ queue=False,
184
+ )
185
+ clear.click(lambda: None, None, chatbot, queue=False).then(
186
+ fn=conversation.clear_history,
187
+ inputs=[chatbot],
188
+ outputs=[chatbot],
189
+ queue=False,
190
+ )
191
+ change.click(
192
+ fn=conversation.set_system_prompt,
193
+ inputs=[system],
194
+ outputs=[system],
195
+ queue=False,
196
+ )
197
+ reset.click(
198
+ fn=conversation.reset_system_prompt,
199
+ inputs=[],
200
+ outputs=[system],
201
+ queue=False,
202
+ )
203
+
204
+
205
+ demo.queue(max_size=36, concurrency_count=14).launch(debug=True)
206