Spaces:
Build error
Build error
Ankur Goyal
commited on
Commit
•
e38e364
1
Parent(s):
4472e08
Use PDF for statement
Browse files- app.py +9 -1
- statement.pdf +0 -0
- statement.png +0 -0
app.py
CHANGED
@@ -84,6 +84,10 @@ examples = [
|
|
84 |
],
|
85 |
]
|
86 |
|
|
|
|
|
|
|
|
|
87 |
|
88 |
def process_path(path):
|
89 |
if path:
|
@@ -162,7 +166,11 @@ def process_question(question, document, model=list(CHECKPOINTS.keys())[0]):
|
|
162 |
|
163 |
def load_example_document(img, question, model):
|
164 |
if img is not None:
|
165 |
-
|
|
|
|
|
|
|
|
|
166 |
preview, answer, answer_text = process_question(question, document, model)
|
167 |
return document, question, preview, gr.update(visible=True), answer, answer_text
|
168 |
else:
|
|
|
84 |
],
|
85 |
]
|
86 |
|
87 |
+
question_files = {
|
88 |
+
"What are net sales for 2020?": "statement.pdf",
|
89 |
+
}
|
90 |
+
|
91 |
|
92 |
def process_path(path):
|
93 |
if path:
|
|
|
166 |
|
167 |
def load_example_document(img, question, model):
|
168 |
if img is not None:
|
169 |
+
if question in question_files:
|
170 |
+
print("using document")
|
171 |
+
document = load_document(question_files[question])
|
172 |
+
else:
|
173 |
+
document = ImageDocument(Image.fromarray(img))
|
174 |
preview, answer, answer_text = process_question(question, document, model)
|
175 |
return document, question, preview, gr.update(visible=True), answer, answer_text
|
176 |
else:
|
statement.pdf
ADDED
The diff for this file is too large to render.
See raw diff
|
|
statement.png
CHANGED