Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,11 +5,11 @@ import json
|
|
| 5 |
|
| 6 |
import datasets
|
| 7 |
|
| 8 |
-
def save_to_dataset(image_path,
|
| 9 |
# Create a dataset dictionary
|
| 10 |
dataset_dict = {
|
| 11 |
"image": image_path,
|
| 12 |
-
"question":
|
| 13 |
"answer_p2s_base": answer_p2s_base,
|
| 14 |
"answer_p2s_large": answer_p2s_large,
|
| 15 |
"answer_layoutlm": answer_layoutlm,
|
|
@@ -54,7 +54,7 @@ def generate_answers(image_path, question):
|
|
| 54 |
answer_donut = generate_answer(image_path, question, model_name = "nielsr-donut-docvqa", space_id = "Donut DocVQA")
|
| 55 |
|
| 56 |
# Save the data to the dataset
|
| 57 |
-
save_to_dataset(image_path,
|
| 58 |
|
| 59 |
return answer_p2s_base, answer_p2s_large, answer_layoutlm, answer_donut
|
| 60 |
|
|
|
|
| 5 |
|
| 6 |
import datasets
|
| 7 |
|
| 8 |
+
def save_to_dataset(image_path, question, answer_p2s_base, answer_p2s_large, answer_layoutlm, answer_donut):
|
| 9 |
# Create a dataset dictionary
|
| 10 |
dataset_dict = {
|
| 11 |
"image": image_path,
|
| 12 |
+
"question": question,
|
| 13 |
"answer_p2s_base": answer_p2s_base,
|
| 14 |
"answer_p2s_large": answer_p2s_large,
|
| 15 |
"answer_layoutlm": answer_layoutlm,
|
|
|
|
| 54 |
answer_donut = generate_answer(image_path, question, model_name = "nielsr-donut-docvqa", space_id = "Donut DocVQA")
|
| 55 |
|
| 56 |
# Save the data to the dataset
|
| 57 |
+
save_to_dataset(image_path, question, answer_p2s_base, answer_p2s_large, answer_layoutlm, answer_donut)
|
| 58 |
|
| 59 |
return answer_p2s_base, answer_p2s_large, answer_layoutlm, answer_donut
|
| 60 |
|