Commit
·
864ff4a
1
Parent(s):
c6d106a
Changes based on @hysts suggestions
Browse filesHoping that I got
@hysts
suggestions correct and this works!
https://huggingface.co/spaces/hysts/BLIP2-with-transformers/discussions/2#64298547f1884027c2a6a7c3
app.py
CHANGED
@@ -40,17 +40,22 @@ def blip2_interface(image, prompted_caption_text, vqa_question, chat_context):
|
|
40 |
|
41 |
# Define Gradio input and output components
|
42 |
image_input = gr.Image(type="numpy")
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
# Create Gradio interface
|
47 |
iface = gr.Interface(
|
48 |
fn=blip2_interface,
|
49 |
-
inputs=[image_input,
|
50 |
-
outputs=[
|
51 |
title="BLIP-2 Image Captioning and VQA",
|
52 |
description="Interact with the BLIP-2 model for image captioning, prompted image captioning, visual question answering, and chat-based prompting.",
|
53 |
)
|
54 |
|
55 |
if __name__ == "__main__":
|
56 |
-
iface.launch()
|
|
|
40 |
|
41 |
# Define Gradio input and output components
|
42 |
image_input = gr.Image(type="numpy")
|
43 |
+
prompted_caption_input = gr.Textbox()
|
44 |
+
vqa_question_input = gr.Textbox()
|
45 |
+
chat_context = gr.Textbox()
|
46 |
+
image_caption_result = gr.Textbox()
|
47 |
+
prompted_caption_result = gr.Textbox()
|
48 |
+
vqa_answer = gr.Textbox()
|
49 |
+
chat_response = gr.Textbox()
|
50 |
|
51 |
# Create Gradio interface
|
52 |
iface = gr.Interface(
|
53 |
fn=blip2_interface,
|
54 |
+
inputs=[image_input, prompted_caption_input, vqa_question_input, chat_context],
|
55 |
+
outputs=[image_caption_result, prompted_caption_result, vqa_answer, chat_response],
|
56 |
title="BLIP-2 Image Captioning and VQA",
|
57 |
description="Interact with the BLIP-2 model for image captioning, prompted image captioning, visual question answering, and chat-based prompting.",
|
58 |
)
|
59 |
|
60 |
if __name__ == "__main__":
|
61 |
+
iface.launch()
|