Spaces:
Running
Running
ankur-bohra
commited on
Commit
•
e853e36
1
Parent(s):
c52d6b0
Update app.py
Browse files
app.py
CHANGED
@@ -43,9 +43,20 @@ def process_document(image, question):
|
|
43 |
description = "Gradio Demo for Donut, an instance of `VisionEncoderDecoderModel` fine-tuned on DocVQA (document visual question answering). To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below."
|
44 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2111.15664' target='_blank'>Donut: OCR-free Document Understanding Transformer</a> | <a href='https://github.com/clovaai/donut' target='_blank'>Github Repo</a></p>"
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
demo = gr.Interface(
|
47 |
fn=process_document,
|
48 |
-
|
49 |
outputs="json",
|
50 |
title="Demo: Donut 🍩 for DocVQA",
|
51 |
description=description,
|
|
|
43 |
description = "Gradio Demo for Donut, an instance of `VisionEncoderDecoderModel` fine-tuned on DocVQA (document visual question answering). To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below."
|
44 |
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2111.15664' target='_blank'>Donut: OCR-free Document Understanding Transformer</a> | <a href='https://github.com/clovaai/donut' target='_blank'>Github Repo</a></p>"
|
45 |
|
46 |
+
vqa_questions = {}
|
47 |
+
vqa_questions["ACCOUNT/BILL NUMBER"] = "What is the account or bill number?"
|
48 |
+
vqa_questions["TOTAL"] = "What is the total amount or total price?"
|
49 |
+
vqa_questions["ITEMS"] = "What are the items?"
|
50 |
+
vqa_questions["GST AMOUNT"] = "What is the GST or tax amount?"
|
51 |
+
vqa_questions["GST NO."] = "What is the GST number?"
|
52 |
+
vqa_questions[
|
53 |
+
"SELLER/BILLING DETAILS"
|
54 |
+
] = "What are the seller details or billing details"
|
55 |
+
vqa_questions["BILLING ADDRESS"] = "What is the billing address?"
|
56 |
+
|
57 |
demo = gr.Interface(
|
58 |
fn=process_document,
|
59 |
+
inputs=["image"] + [gr.components.Textbox(value=question) for question in vqa_questions.values()],
|
60 |
outputs="json",
|
61 |
title="Demo: Donut 🍩 for DocVQA",
|
62 |
description=description,
|