Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -75,6 +75,36 @@ def normalize_bbox(box, width, height, padding=0.005):
|
|
| 75 |
return [min_x * width, min_y * height, max_x * width, max_y * height]
|
| 76 |
|
| 77 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
def process_path(path):
|
| 79 |
error = None
|
| 80 |
if path:
|
|
|
|
| 75 |
return [min_x * width, min_y * height, max_x * width, max_y * height]
|
| 76 |
|
| 77 |
|
| 78 |
+
examples = [
|
| 79 |
+
[
|
| 80 |
+
"invoice.png",
|
| 81 |
+
"What is the invoice number?",
|
| 82 |
+
],
|
| 83 |
+
[
|
| 84 |
+
"contract.jpeg",
|
| 85 |
+
"What is the purchase amount?",
|
| 86 |
+
],
|
| 87 |
+
[
|
| 88 |
+
"statement.png",
|
| 89 |
+
"What are net sales for 2020?",
|
| 90 |
+
],
|
| 91 |
+
# [
|
| 92 |
+
# "docquery.png",
|
| 93 |
+
# "How many likes does the space have?",
|
| 94 |
+
# ],
|
| 95 |
+
# [
|
| 96 |
+
# "hacker_news.png",
|
| 97 |
+
# "What is the title of post number 5?",
|
| 98 |
+
# ],
|
| 99 |
+
]
|
| 100 |
+
|
| 101 |
+
question_files = {
|
| 102 |
+
"What are net sales for 2020?": "statement.pdf",
|
| 103 |
+
"How many likes does the space have?": "https://huggingface.co/spaces/impira/docquery",
|
| 104 |
+
"What is the title of post number 5?": "https://news.ycombinator.com",
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
def process_path(path):
|
| 109 |
error = None
|
| 110 |
if path:
|