Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -267,10 +267,13 @@ def process_and_output_files(input_files):
|
|
267 |
|
268 |
df = pd.DataFrame(string_data)
|
269 |
|
270 |
-
|
|
|
271 |
|
|
|
272 |
scrollable_table = f'<div style="overflow-x: auto;">{table_html}</div>'
|
273 |
-
|
|
|
274 |
|
275 |
#return data
|
276 |
|
@@ -370,7 +373,9 @@ with gr.Blocks(title="Automatic Reimbursement Tool Demo") as page:
|
|
370 |
height=240,
|
371 |
)
|
372 |
#information = gr.JSON(label="Extracted information")
|
373 |
-
|
|
|
|
|
374 |
|
375 |
with gr.Row():
|
376 |
flag_incorrect_button = gr.Button(
|
@@ -400,11 +405,11 @@ with gr.Blocks(title="Automatic Reimbursement Tool Demo") as page:
|
|
400 |
submit_button.click(
|
401 |
clear_outputs,
|
402 |
[input_file],
|
403 |
-
[extracted_text, category, chatbot,
|
404 |
).then(
|
405 |
process_and_output_files,
|
406 |
[input_file],
|
407 |
-
[
|
408 |
).then(
|
409 |
flag_if_shared(flag_method),
|
410 |
[
|
|
|
267 |
|
268 |
df = pd.DataFrame(string_data)
|
269 |
|
270 |
+
filename = "output.xlsx"
|
271 |
+
df.to_excel(filename, index=False)
|
272 |
|
273 |
+
table_html = df.to_html(classes="table table-bordered", index=True)
|
274 |
scrollable_table = f'<div style="overflow-x: auto;">{table_html}</div>'
|
275 |
+
|
276 |
+
return scrollable_table, filename
|
277 |
|
278 |
#return data
|
279 |
|
|
|
373 |
height=240,
|
374 |
)
|
375 |
#information = gr.JSON(label="Extracted information")
|
376 |
+
table_display = gr.HTML(label="Table Display")
|
377 |
+
excel_download = gr.File(label="Download Excel", type="file")
|
378 |
+
|
379 |
|
380 |
with gr.Row():
|
381 |
flag_incorrect_button = gr.Button(
|
|
|
405 |
submit_button.click(
|
406 |
clear_outputs,
|
407 |
[input_file],
|
408 |
+
[extracted_text, category, chatbot, table_display],
|
409 |
).then(
|
410 |
process_and_output_files,
|
411 |
[input_file],
|
412 |
+
[table_display, excel_download], # Adding excel_download here
|
413 |
).then(
|
414 |
flag_if_shared(flag_method),
|
415 |
[
|