Tonic commited on
Commit
5207986
·
1 Parent(s): 9bffb27

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -7
app.py CHANGED
@@ -35,7 +35,7 @@ def _get_args() -> ArgumentParser:
35
  args = parser.parse_args()
36
  return args
37
 
38
- def handle_image_submission(_chatbot, task_history, file) -> tuple:
39
  print("handle_image_submission called")
40
  if file is None:
41
  print("No file uploaded")
@@ -251,32 +251,36 @@ Join us : 🌟TeamTonic🌟 is always making cool demos! Join our active builder
251
  submit_btn.click(
252
  fn=predict,
253
  inputs=[chatbot, task_history],
254
- outputs=[chatbot]
 
255
  )
256
 
257
  submit_file_btn.click(
258
  fn=handle_image_submission,
259
  inputs=[chatbot, task_history, file_upload],
260
- outputs=[chatbot, task_history]
 
261
  )
262
 
263
-
264
  regen_btn.click(
265
  fn=regenerate,
266
  inputs=[chatbot, task_history],
267
- outputs=[chatbot]
 
268
  )
269
 
270
  empty_bin.click(
271
  fn=reset_state,
272
  inputs=[task_history],
273
- outputs=[task_history]
 
274
  )
275
 
276
  query.submit(
277
  fn=add_text,
278
  inputs=[chatbot, task_history, query],
279
- outputs=[chatbot, task_history, query]
 
280
  )
281
 
282
  gr.Markdown("""
 
35
  args = parser.parse_args()
36
  return args
37
 
38
+ def handle_image_submission(_chatbot, task_history, file, tokenizer, model) -> tuple:
39
  print("handle_image_submission called")
40
  if file is None:
41
  print("No file uploaded")
 
251
  submit_btn.click(
252
  fn=predict,
253
  inputs=[chatbot, task_history],
254
+ outputs=[chatbot],
255
+ _state=[tokenizer, model]
256
  )
257
 
258
  submit_file_btn.click(
259
  fn=handle_image_submission,
260
  inputs=[chatbot, task_history, file_upload],
261
+ outputs=[chatbot, task_history],
262
+ _state=[tokenizer, model]
263
  )
264
 
 
265
  regen_btn.click(
266
  fn=regenerate,
267
  inputs=[chatbot, task_history],
268
+ outputs=[chatbot],
269
+ _state=[tokenizer, model]
270
  )
271
 
272
  empty_bin.click(
273
  fn=reset_state,
274
  inputs=[task_history],
275
+ outputs=[task_history],
276
+ _state=[tokenizer, model]
277
  )
278
 
279
  query.submit(
280
  fn=add_text,
281
  inputs=[chatbot, task_history, query],
282
+ outputs=[chatbot, task_history, query],
283
+ _state=[tokenizer, model]
284
  )
285
 
286
  gr.Markdown("""