Spaces:
Runtime error
Runtime error
hanjiaming.0208
commited on
Commit
·
59bb14b
1
Parent(s):
134a323
update
Browse files
app.py
CHANGED
|
@@ -101,26 +101,26 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 101 |
outputs=[prompt, output_image]
|
| 102 |
)
|
| 103 |
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
qa_btn.click(
|
| 116 |
-
understand_image,
|
| 117 |
-
inputs=[image_input, question_input],
|
| 118 |
-
outputs=answer_output
|
| 119 |
-
)
|
| 120 |
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
demo.launch(share=True)
|
|
|
|
| 101 |
outputs=[prompt, output_image]
|
| 102 |
)
|
| 103 |
|
| 104 |
+
with gr.Tab("Image Understanding"):
|
| 105 |
+
with gr.Row():
|
| 106 |
+
with gr.Column(scale=1):
|
| 107 |
+
image_input = gr.Image(label="Upload Image", type="pil")
|
| 108 |
+
question_input = gr.Textbox(label="Instruction", value="Describe the image shortly.")
|
| 109 |
+
with gr.Row():
|
| 110 |
+
qa_btn = gr.Button("Generate")
|
| 111 |
+
clear_btn_i2t = gr.Button("Clear")
|
| 112 |
+
with gr.Column(scale=1):
|
| 113 |
+
answer_output = gr.Textbox(label="Response", lines=4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
+
qa_btn.click(
|
| 116 |
+
understand_image,
|
| 117 |
+
inputs=[image_input, question_input],
|
| 118 |
+
outputs=answer_output
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
clear_btn_i2t.click(
|
| 122 |
+
clear_inputs_i2t,
|
| 123 |
+
outputs=[image_input, question_input, answer_output]
|
| 124 |
+
)
|
| 125 |
|
| 126 |
demo.launch(share=True)
|