Update app.py
Browse files
app.py
CHANGED
|
@@ -71,28 +71,28 @@ def normalize_bbox(box, width, height, padding=0.005):
|
|
| 71 |
return [min_x * width, min_y * height, max_x * width, max_y * height]
|
| 72 |
|
| 73 |
|
| 74 |
-
examples = [
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
]
|
| 96 |
|
| 97 |
question_files = {
|
| 98 |
"What are net sales for 2020?": "statement.pdf",
|
|
@@ -288,15 +288,15 @@ gradio-app h2, .gradio-app h2 {
|
|
| 288 |
"""
|
| 289 |
|
| 290 |
with gr.Blocks(css=CSS) as demo:
|
| 291 |
-
gr.Markdown("#
|
| 292 |
-
gr.Markdown(
|
| 293 |
-
|
| 294 |
-
|
| 295 |
-
|
| 296 |
-
|
| 297 |
-
|
| 298 |
-
|
| 299 |
-
)
|
| 300 |
|
| 301 |
document = gr.Variable()
|
| 302 |
example_question = gr.Textbox(visible=False)
|
|
@@ -339,7 +339,7 @@ with gr.Blocks(css=CSS) as demo:
|
|
| 339 |
gr.Markdown("## 2. Ask a question")
|
| 340 |
question = gr.Textbox(
|
| 341 |
label="Question",
|
| 342 |
-
placeholder="e.g. What is the
|
| 343 |
lines=1,
|
| 344 |
max_lines=1,
|
| 345 |
)
|
|
|
|
| 71 |
return [min_x * width, min_y * height, max_x * width, max_y * height]
|
| 72 |
|
| 73 |
|
| 74 |
+
# examples = [
|
| 75 |
+
# [
|
| 76 |
+
# "invoice.png",
|
| 77 |
+
# "What is the invoice number?",
|
| 78 |
+
# ],
|
| 79 |
+
# [
|
| 80 |
+
# "contract.jpeg",
|
| 81 |
+
# "What is the purchase amount?",
|
| 82 |
+
# ],
|
| 83 |
+
# [
|
| 84 |
+
# "statement.png",
|
| 85 |
+
# "What are net sales for 2020?",
|
| 86 |
+
# ],
|
| 87 |
+
# # [
|
| 88 |
+
# # "docquery.png",
|
| 89 |
+
# # "How many likes does the space have?",
|
| 90 |
+
# # ],
|
| 91 |
+
# # [
|
| 92 |
+
# # "hacker_news.png",
|
| 93 |
+
# # "What is the title of post number 5?",
|
| 94 |
+
# # ],
|
| 95 |
+
# ]
|
| 96 |
|
| 97 |
question_files = {
|
| 98 |
"What are net sales for 2020?": "statement.pdf",
|
|
|
|
| 288 |
"""
|
| 289 |
|
| 290 |
with gr.Blocks(css=CSS) as demo:
|
| 291 |
+
gr.Markdown("# PDFPlus")
|
| 292 |
+
# gr.Markdown(
|
| 293 |
+
# "DocQuery (created by [Impira](https://impira.com?utm_source=huggingface&utm_medium=referral&utm_campaign=docquery_space))"
|
| 294 |
+
# " uses LayoutLMv1 fine-tuned on DocVQA, a document visual question"
|
| 295 |
+
# " answering dataset, as well as SQuAD, which boosts its English-language comprehension."
|
| 296 |
+
# " To use it, simply upload an image or PDF, type a question, and click 'submit', or "
|
| 297 |
+
# " click one of the examples to load them."
|
| 298 |
+
# " DocQuery is MIT-licensed and available on [Github](https://github.com/impira/docquery)."
|
| 299 |
+
# )
|
| 300 |
|
| 301 |
document = gr.Variable()
|
| 302 |
example_question = gr.Textbox(visible=False)
|
|
|
|
| 339 |
gr.Markdown("## 2. Ask a question")
|
| 340 |
question = gr.Textbox(
|
| 341 |
label="Question",
|
| 342 |
+
placeholder="e.g. What is the patient name?",
|
| 343 |
lines=1,
|
| 344 |
max_lines=1,
|
| 345 |
)
|