Garvitj commited on
Commit
3b6bab2
·
verified ·
1 Parent(s): b835d1f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -366,16 +366,20 @@ with gr.Blocks(theme="soft") as demo:
366
  chatbot = gr.Chatbot(label="ChatGPT-Like Chat")
367
  video_input = gr.Video(label="Upload Video (Optional)")
368
  text_input = gr.Textbox(label="Enter Text (Optional)", placeholder="Type your message here...")
369
-
 
370
  clear_button = gr.Button("Clear Chat")
371
 
372
  def clear_chat():
373
- return [], None, None
 
 
 
 
374
 
375
- video_input.change(clear_chat, outputs=[chatbot, video_input, text_input])
376
- text_input.submit(respond, inputs=[video_input, text_input, chatbot], outputs=[chatbot])
377
  clear_button.click(clear_chat, outputs=[chatbot, video_input, text_input])
378
 
379
  # Launch chatbot
380
  if __name__ == "__main__":
381
- demo.launch()
 
366
  chatbot = gr.Chatbot(label="ChatGPT-Like Chat")
367
  video_input = gr.Video(label="Upload Video (Optional)")
368
  text_input = gr.Textbox(label="Enter Text (Optional)", placeholder="Type your message here...")
369
+ submit_button = gr.Button("Submit") # ✅ Added a submit button
370
+
371
  clear_button = gr.Button("Clear Chat")
372
 
373
  def clear_chat():
374
+ return [], None, ""
375
+
376
+ # ✅ Fix: Prevent video from disappearing instantly
377
+ def process_input(video, text):
378
+ return respond(video, text, chatbot)
379
 
380
+ submit_button.click(process_input, inputs=[video_input, text_input], outputs=[chatbot])
 
381
  clear_button.click(clear_chat, outputs=[chatbot, video_input, text_input])
382
 
383
  # Launch chatbot
384
  if __name__ == "__main__":
385
+ demo.launch()