Tonic commited on
Commit
ec3bf4d
Β·
1 Parent(s): e485172

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -192,31 +192,34 @@ def _launch_demo(args, model, tokenizer):
192
  chatbot = gr.Chatbot(label='Qwen-VL-Chat')
193
  with gr.Column(scale=1):
194
  with gr.Row():
195
- query = gr.Textbox(lines=2, label='Input', placeholder="Type your message here...")
196
- submit_btn = gr.Button("πŸš€ Submit")
197
  with gr.Row():
198
- addfile_btn = gr.UploadButton("πŸ“ Upload Image", file_types=["image"])
 
199
  regen_btn = gr.Button("πŸ€”οΈ Regenerate")
200
  empty_bin = gr.Button("🧹 Clear History")
201
  task_history = gr.State([])
 
 
202
  submit_btn.click(
203
  fn=predict,
204
  inputs=[chatbot, task_history],
205
  outputs=[chatbot]
206
  )
207
 
 
 
 
 
 
 
208
  regen_btn.click(
209
  fn=regenerate,
210
  inputs=[chatbot, task_history],
211
  outputs=[chatbot]
212
  )
213
 
214
- addfile_btn.change(
215
- fn=add_file,
216
- inputs=[chatbot, task_history, addfile_btn],
217
- outputs=[chatbot, task_history]
218
- )
219
-
220
  empty_bin.click(
221
  fn=reset_state,
222
  inputs=[task_history],
 
192
  chatbot = gr.Chatbot(label='Qwen-VL-Chat')
193
  with gr.Column(scale=1):
194
  with gr.Row():
195
+ query = gr.Textbox(lines=2, label='Input', placeholder="Type your message here...")
196
+ submit_btn = gr.Button("πŸš€ Submit")
197
  with gr.Row():
198
+ file_upload = gr.UploadButton("πŸ“ Upload Image", file_types=["image"])
199
+ submit_file_btn = gr.Button("Submit Image")
200
  regen_btn = gr.Button("πŸ€”οΈ Regenerate")
201
  empty_bin = gr.Button("🧹 Clear History")
202
  task_history = gr.State([])
203
+
204
+ # Linking the buttons and inputs to their functions
205
  submit_btn.click(
206
  fn=predict,
207
  inputs=[chatbot, task_history],
208
  outputs=[chatbot]
209
  )
210
 
211
+ submit_file_btn.click(
212
+ fn=add_file,
213
+ inputs=[chatbot, task_history, file_upload],
214
+ outputs=[chatbot, task_history]
215
+ )
216
+
217
  regen_btn.click(
218
  fn=regenerate,
219
  inputs=[chatbot, task_history],
220
  outputs=[chatbot]
221
  )
222
 
 
 
 
 
 
 
223
  empty_bin.click(
224
  fn=reset_state,
225
  inputs=[task_history],