Update app.py
Browse files
app.py
CHANGED
@@ -107,15 +107,20 @@ def get_answer(image, url, question) -> str:
|
|
107 |
|
108 |
|
109 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
with gr.Row():
|
111 |
with gr.Column():
|
112 |
-
gr.Markdown(
|
113 |
-
"""
|
114 |
-
# Donut-OCR-VQA
|
115 |
-
This demo uses fine-tuned OCR-VQA-Donut model on OCR-VQA-200k to answer questions about images.
|
116 |
-
Feel free to try it out!
|
117 |
-
"""
|
118 |
-
)
|
119 |
|
120 |
image = gr.Image(shape=(224, 224), type="pil")
|
121 |
image_url = gr.Textbox(lines=1, label="Image URL", placeholder="Or, paste the image URL here")
|
@@ -124,14 +129,6 @@ with gr.Blocks() as demo:
|
|
124 |
ask = gr.Button(label="Get the answer")
|
125 |
|
126 |
with gr.Column():
|
127 |
-
gr.Markdown(
|
128 |
-
"""
|
129 |
-
# IO description
|
130 |
-
- Input is an image or URL that represents a book cover (recommended) and a question that asks about information on the image.
|
131 |
-
- Output: an answer to the question.
|
132 |
-
"""
|
133 |
-
)
|
134 |
-
|
135 |
answer = gr.Label(label="Answer")
|
136 |
|
137 |
ask.click(get_answer, inputs=[image, image_url, question], outputs=[answer])
|
|
|
107 |
|
108 |
|
109 |
with gr.Blocks() as demo:
|
110 |
+
with gr.Row():
|
111 |
+
gr.Markdown(
|
112 |
+
"""
|
113 |
+
## Donut-OCR-VQA
|
114 |
+
- This demo uses fine-tuned OCR-VQA-Donut model on OCR-VQA-200k to answer questions about images.
|
115 |
+
|
116 |
+
## IO description
|
117 |
+
- Input is an image or URL that represents a book cover (recommended) and a question that asks about information on the image.
|
118 |
+
- Output: an answer to the question.
|
119 |
+
"""
|
120 |
+
)
|
121 |
+
|
122 |
with gr.Row():
|
123 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
|
125 |
image = gr.Image(shape=(224, 224), type="pil")
|
126 |
image_url = gr.Textbox(lines=1, label="Image URL", placeholder="Or, paste the image URL here")
|
|
|
129 |
ask = gr.Button(label="Get the answer")
|
130 |
|
131 |
with gr.Column():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
answer = gr.Label(label="Answer")
|
133 |
|
134 |
ask.click(get_answer, inputs=[image, image_url, question], outputs=[answer])
|