Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
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 |
-
|
|
|
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
|
48 |
-
submit_btn.click(fn=
|
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(
|