Spaces:
Build error
Build error
MrFeelgoood
commited on
Commit
•
1adfa10
1
Parent(s):
03f503a
Fixed format of extracted text
Browse files
app.py
CHANGED
@@ -266,15 +266,16 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
266 |
gr.Markdown(
|
267 |
'''
|
268 |
# PDF Mq Extractor
|
269 |
-
Set the params and switch the tabs to see the output.
|
270 |
''')
|
271 |
with gr.Tab("Extractor"):
|
272 |
with gr.Row():
|
273 |
pdf_input = gr.components.File(label="PDF File")
|
274 |
|
275 |
with gr.Row():
|
276 |
-
model_input = gr.components.Dropdown(['it5/it5-
|
277 |
-
|
|
|
|
|
278 |
|
279 |
with gr.Column():
|
280 |
gr.Markdown(
|
@@ -287,12 +288,14 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
287 |
|
288 |
values_output = gr.components.Textbox(label="Area Values")
|
289 |
total_output = gr.components.Textbox(label="Total")
|
|
|
290 |
with gr.Row():
|
291 |
extract_button = gr.Button("Extract")
|
292 |
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
296 |
gr.Examples(['Example1.pdf', 'Example2.pdf'], inputs = pdf_input)
|
297 |
|
298 |
demo.launch()
|
|
|
266 |
gr.Markdown(
|
267 |
'''
|
268 |
# PDF Mq Extractor
|
|
|
269 |
''')
|
270 |
with gr.Tab("Extractor"):
|
271 |
with gr.Row():
|
272 |
pdf_input = gr.components.File(label="PDF File")
|
273 |
|
274 |
with gr.Row():
|
275 |
+
model_input = gr.components.Dropdown(['it5/it5-small-question-answering', 'it5/it5-base-question-answering'],
|
276 |
+
value= 'it5/it5-small-question-answering', label = 'Select model')
|
277 |
+
question_input = gr.components.Dropdown(["Quanti metri quadri misura l'immobile?"],
|
278 |
+
value = "Quanti metri quadri misura l'immobile?", label = 'Question')
|
279 |
|
280 |
with gr.Column():
|
281 |
gr.Markdown(
|
|
|
288 |
|
289 |
values_output = gr.components.Textbox(label="Area Values")
|
290 |
total_output = gr.components.Textbox(label="Total")
|
291 |
+
text_output = gr.components.Textbox(label="Ref. Text")
|
292 |
with gr.Row():
|
293 |
extract_button = gr.Button("Extract")
|
294 |
|
295 |
+
|
296 |
+
extract_button.click(fn = ocr_interface,
|
297 |
+
inputs=[pdf_input, model_input, question_input], outputs=[values_output, total_output, text_output])
|
298 |
+
|
299 |
gr.Examples(['Example1.pdf', 'Example2.pdf'], inputs = pdf_input)
|
300 |
|
301 |
demo.launch()
|