TobyYang7 commited on
Commit
386e329
1 Parent(s): 03d6908

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -24,7 +24,8 @@ tokenizer, llava_model, image_processor, context_len = load_pretrained_model(
24
  )
25
 
26
  # Define the prediction function
27
- def predict(image, text, history):
 
28
  output = chat_llava(
29
  args=None,
30
  image_file=image,
@@ -44,8 +45,8 @@ with gr.Blocks() as demo:
44
  text_input = gr.Textbox(label="Enter your message")
45
  submit_btn = gr.Button("Submit")
46
 
47
- # Define interaction: when submit is clicked, call predict and update the chatbot
48
- submit_btn.click(fn=predict, inputs=[image_input, text_input, chatbot], outputs=[chatbot, text_input])
49
 
50
  # Add example inputs
51
  gr.Examples(
 
24
  )
25
 
26
  # Define the prediction function
27
+ @spaces.GPU
28
+ def bot_streaming(image, text, history):
29
  output = chat_llava(
30
  args=None,
31
  image_file=image,
 
45
  text_input = gr.Textbox(label="Enter your message")
46
  submit_btn = gr.Button("Submit")
47
 
48
+ # Define interaction: when submit is clicked, call bot_streaming and update the chatbot
49
+ submit_btn.click(fn=bot_streaming, inputs=[image_input, text_input, chatbot], outputs=[chatbot, text_input])
50
 
51
  # Add example inputs
52
  gr.Examples(