Skip to content

Commit

Permalink
Merge pull request #24 from VikParuchuri/dev
Browse files Browse the repository at this point in the history
Fix CLI bug
  • Loading branch information
VikParuchuri authored Nov 28, 2024
2 parents 9244e08 + 46345b6 commit 9eb735f
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 12 deletions.
1 change: 0 additions & 1 deletion extract.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
from collections import defaultdict

import pypdfium2
import copy
import os

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "tabled-pdf"
version = "0.1.5"
version = "0.1.6"
description = "Detect and recognize tables in PDFs and images."
authors = ["Vik Paruchuri <[email protected]>"]
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions table_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def page_count(pdf_file):
page_number = 1

with col:
st.image(pil_image, caption="PDF file (preview)", use_column_width="auto")
st.image(pil_image, caption="PDF file (preview)", use_container_width=True)

run_marker = st.sidebar.button("Run Tabled")

Expand All @@ -122,7 +122,7 @@ def page_count(pdf_file):

for idx, (md, table_img) in enumerate(out_data):
container.markdown(f"## Table {idx}")
container.image(table_img, caption=f"Table {idx}", use_column_width="auto")
container.image(table_img, caption=f"Table {idx}", use_container_width=True)
container.markdown(md)
container.code(md)
container.divider()
Expand Down
2 changes: 1 addition & 1 deletion tabled/formats/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def replace_special_chars(text):
return text.replace("|", "\|").replace("-", "\-")
return text.replace("|", "\\|").replace("-", "\\-")


def replace_all(text):
Expand Down
7 changes: 3 additions & 4 deletions tabled/inference/detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ def merge_tables(page_table_boxes):
return [b for i, b in enumerate(page_table_boxes) if i not in ignore_boxes]


def detect_tables(images, highres_images, models, detector_batch_size=settings.DETECTOR_BATCH_SIZE, layout_batch_size=settings.LAYOUT_BATCH_SIZE):
det_model, det_processor, layout_model, layout_processor = models
line_predictions = batch_text_detection(images, det_model, det_processor, batch_size=detector_batch_size)
layout_predictions = batch_layout_detection(images, layout_model, layout_processor, line_predictions, batch_size=layout_batch_size)
def detect_tables(images, highres_images, models, layout_batch_size=settings.LAYOUT_BATCH_SIZE):
layout_model, layout_processor = models
layout_predictions = batch_layout_detection(images, layout_model, layout_processor, batch_size=layout_batch_size)

table_imgs = []
table_counts = []
Expand Down
4 changes: 1 addition & 3 deletions tabled/inference/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@


def load_detection_models():
det_model = load_det_model()
det_processor = load_det_processor()
layout_model = load_layout_model()
layout_processor = load_layout_processor()
return det_model, det_processor, layout_model, layout_processor
return layout_model, layout_processor


def load_recognition_models():
Expand Down

0 comments on commit 9eb735f

Please sign in to comment.