Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -291,16 +291,16 @@ def create_dataframe(cells_pytess_result:list, max_cols:int, max_rows:int,csv_pa
|
|
291 |
|
292 |
return df
|
293 |
|
294 |
-
def process_image(image,
|
295 |
image = image.convert('RGB')
|
296 |
-
model, probas, bboxes_scaled = table_detector(image, THRESHOLD_PROBA=
|
297 |
# plot_results_detection(model, image, probas, bboxes_scaled, delta_xmin, delta_ymin, delta_xmax, delta_ymax)
|
298 |
cropped_img_list = crop_tables(image, probas, bboxes_scaled, delta_xmin, delta_ymin, delta_xmax, delta_ymax)
|
299 |
|
300 |
result = []
|
301 |
for idx, unpadded_table in enumerate(cropped_img_list):
|
302 |
table = add_padding(unpadded_table, padd_top, padd_right, padd_bottom, padd_left)
|
303 |
-
model, probas, bboxes_scaled = table_struct_recog(table, THRESHOLD_PROBA=
|
304 |
rows, cols = generate_structure(model, table, probas, bboxes_scaled, expand_rowcol_bbox_top, expand_rowcol_bbox_bottom)
|
305 |
rows, cols = sort_table_featuresv2(rows, cols)
|
306 |
master_row, cols = individual_table_featuresv2(table, rows, cols)
|
@@ -323,10 +323,10 @@ article = "<p style='text-align: center'></p>"
|
|
323 |
examples =[["image_0.png"]]
|
324 |
|
325 |
iface = gr.Interface(fn=process_image,
|
326 |
-
inputs=[gr.Image(type="pil"), gr.Slider(0, 1,
|
327 |
outputs="text",
|
328 |
title=title,
|
329 |
description=description,
|
330 |
article=article,
|
331 |
examples=examples)
|
332 |
-
iface.launch(debug=True)
|
|
|
291 |
|
292 |
return df
|
293 |
|
294 |
+
def process_image(image, td_threshold, tsr_threshold, padd_top, padd_left, padd_bottom, padd_right, delta_xmin, delta_ymin, delta_xmax, delta_ymax, expand_rowcol_bbox_top, expand_rowcol_bbox_bottom):
|
295 |
image = image.convert('RGB')
|
296 |
+
model, probas, bboxes_scaled = table_detector(image, THRESHOLD_PROBA=td_threshold)
|
297 |
# plot_results_detection(model, image, probas, bboxes_scaled, delta_xmin, delta_ymin, delta_xmax, delta_ymax)
|
298 |
cropped_img_list = crop_tables(image, probas, bboxes_scaled, delta_xmin, delta_ymin, delta_xmax, delta_ymax)
|
299 |
|
300 |
result = []
|
301 |
for idx, unpadded_table in enumerate(cropped_img_list):
|
302 |
table = add_padding(unpadded_table, padd_top, padd_right, padd_bottom, padd_left)
|
303 |
+
model, probas, bboxes_scaled = table_struct_recog(table, THRESHOLD_PROBA=tsr_threshold)
|
304 |
rows, cols = generate_structure(model, table, probas, bboxes_scaled, expand_rowcol_bbox_top, expand_rowcol_bbox_bottom)
|
305 |
rows, cols = sort_table_featuresv2(rows, cols)
|
306 |
master_row, cols = individual_table_featuresv2(table, rows, cols)
|
|
|
323 |
examples =[["image_0.png"]]
|
324 |
|
325 |
iface = gr.Interface(fn=process_image,
|
326 |
+
inputs=[gr.Image(type="pil"), gr.Slider(0, 1, 0.9), gr.Slider(0, 1, 0.8), gr.Slider(0, 200, 100), gr.Slider(0, 200, 100), gr.Slider(0, 200, 100), gr.Slider(0, 200, 100), gr.Number(0), gr.Number(0), gr.Number(0), gr.Number(0),gr.Number(0),gr.Number(0)],
|
327 |
outputs="text",
|
328 |
title=title,
|
329 |
description=description,
|
330 |
article=article,
|
331 |
examples=examples)
|
332 |
+
iface.launch(debug=True)
|