Update app.py
Browse files
app.py
CHANGED
@@ -21,9 +21,10 @@ def ensure_list(x):
|
|
21 |
|
22 |
|
23 |
CHECKPOINTS = {
|
24 |
-
"
|
25 |
-
"
|
26 |
-
"
|
|
|
27 |
}
|
28 |
|
29 |
PIPELINES = {}
|
@@ -74,15 +75,15 @@ def normalize_bbox(box, width, height, padding=0.005):
|
|
74 |
examples = [
|
75 |
[
|
76 |
"invoice.png",
|
77 |
-
"
|
78 |
],
|
79 |
[
|
80 |
"contract.jpeg",
|
81 |
-
"
|
82 |
],
|
83 |
[
|
84 |
"statement.png",
|
85 |
-
"
|
86 |
],
|
87 |
# [
|
88 |
# "docquery.png",
|
@@ -95,9 +96,9 @@ examples = [
|
|
95 |
]
|
96 |
|
97 |
question_files = {
|
98 |
-
"
|
99 |
-
"
|
100 |
-
"
|
101 |
}
|
102 |
|
103 |
|
@@ -288,7 +289,7 @@ gradio-app h2, .gradio-app h2 {
|
|
288 |
"""
|
289 |
|
290 |
with gr.Blocks(css=CSS) as demo:
|
291 |
-
gr.Markdown("
|
292 |
|
293 |
document = gr.Variable()
|
294 |
example_question = gr.Textbox(visible=False)
|
@@ -297,9 +298,9 @@ with gr.Blocks(css=CSS) as demo:
|
|
297 |
with gr.Row(equal_height=True):
|
298 |
with gr.Column():
|
299 |
with gr.Row():
|
300 |
-
gr.Markdown("## 1.
|
301 |
img_clear_button = gr.Button(
|
302 |
-
"
|
303 |
)
|
304 |
image = gr.Gallery(visible=False)
|
305 |
with gr.Row(equal_height=True):
|
@@ -328,10 +329,10 @@ with gr.Blocks(css=CSS) as demo:
|
|
328 |
)
|
329 |
|
330 |
with gr.Column() as col:
|
331 |
-
gr.Markdown("## 2.
|
332 |
question = gr.Textbox(
|
333 |
label="Question",
|
334 |
-
placeholder="e.g.
|
335 |
lines=1,
|
336 |
max_lines=1,
|
337 |
)
|
@@ -344,11 +345,11 @@ with gr.Blocks(css=CSS) as demo:
|
|
344 |
with gr.Row():
|
345 |
clear_button = gr.Button("Clear", variant="secondary")
|
346 |
submit_button = gr.Button(
|
347 |
-
"
|
348 |
)
|
349 |
with gr.Column():
|
350 |
output_text = gr.Textbox(
|
351 |
-
label="
|
352 |
)
|
353 |
output = gr.JSON(label="Output", visible=False)
|
354 |
|
|
|
21 |
|
22 |
|
23 |
CHECKPOINTS = {
|
24 |
+
"CQI FLMv1 Base PT": "impira/layoutlm-document-qa",
|
25 |
+
"CQI FLMv1 para Faturas 💸": "impira/layoutlm-invoices",
|
26 |
+
"CQI FDonut": "naver-clova-ix/donut-base-finetuned-docvqa",
|
27 |
+
"CQI Assistant Eyes 🤖": "cloudqi/CQI_Visual_Question_Awnser_PT_v0"
|
28 |
}
|
29 |
|
30 |
PIPELINES = {}
|
|
|
75 |
examples = [
|
76 |
[
|
77 |
"invoice.png",
|
78 |
+
"Qual é o número da fatura?",
|
79 |
],
|
80 |
[
|
81 |
"contract.jpeg",
|
82 |
+
"Qual é o valor da compra?",
|
83 |
],
|
84 |
[
|
85 |
"statement.png",
|
86 |
+
"Quais são as vendas líquidas para 2020?",
|
87 |
],
|
88 |
# [
|
89 |
# "docquery.png",
|
|
|
96 |
]
|
97 |
|
98 |
question_files = {
|
99 |
+
"Quais são as vendas líquidas para 2020?": "statement.pdf",
|
100 |
+
"Quantas curtidas tem o espaço?": "https://huggingface.co/spaces/impira/docquery",
|
101 |
+
"Qual é o título do post número 5?": "https://news.ycombinator.com",
|
102 |
}
|
103 |
|
104 |
|
|
|
289 |
"""
|
290 |
|
291 |
with gr.Blocks(css=CSS) as demo:
|
292 |
+
gr.Markdown("## Mecanismo de Consulta de Documentos")
|
293 |
|
294 |
document = gr.Variable()
|
295 |
example_question = gr.Textbox(visible=False)
|
|
|
298 |
with gr.Row(equal_height=True):
|
299 |
with gr.Column():
|
300 |
with gr.Row():
|
301 |
+
gr.Markdown("## 1. Selecione um arquivo", elem_id="select-a-file")
|
302 |
img_clear_button = gr.Button(
|
303 |
+
"Limpar", variant="secondary", elem_id="file-clear", visible=False
|
304 |
)
|
305 |
image = gr.Gallery(visible=False)
|
306 |
with gr.Row(equal_height=True):
|
|
|
329 |
)
|
330 |
|
331 |
with gr.Column() as col:
|
332 |
+
gr.Markdown("## 2. Faça uma pergunta")
|
333 |
question = gr.Textbox(
|
334 |
label="Question",
|
335 |
+
placeholder="e.g. Qual é o número da fatura?",
|
336 |
lines=1,
|
337 |
max_lines=1,
|
338 |
)
|
|
|
345 |
with gr.Row():
|
346 |
clear_button = gr.Button("Clear", variant="secondary")
|
347 |
submit_button = gr.Button(
|
348 |
+
"Enviar", variant="primary", elem_id="submit-button"
|
349 |
)
|
350 |
with gr.Column():
|
351 |
output_text = gr.Textbox(
|
352 |
+
label="Resposta principal", visible=False, elem_id="answer"
|
353 |
)
|
354 |
output = gr.JSON(label="Output", visible=False)
|
355 |
|