Skip to content

Commit

Permalink
Fix streamlit app
Browse files Browse the repository at this point in the history
  • Loading branch information
tarun-menta committed Feb 10, 2025
1 parent d349f30 commit 880fad4
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions surya/scripts/streamlit_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def text_detection(img) -> (Image.Image, TextDetectionResult):
text_pred = predictors["detection"]([img])[0]
text_polygons = [p.polygon for p in text_pred.bboxes]
det_img = draw_polys_on_image(text_polygons, img.copy())
return det_img, text_pred, inline_pred
return det_img, text_pred


def layout_detection(img) -> (Image.Image, LayoutResult):
Expand Down Expand Up @@ -211,11 +211,10 @@ def page_counter(pdf_file):

# Run Text Detection
if run_text_det:
det_img, text_pred, inline_pred = text_detection(pil_image)
det_img, text_pred = text_detection(pil_image)
with col1:
st.image(det_img, caption="Detected Text", use_container_width=True)
st.json(text_pred.model_dump(exclude=["heatmap", "affinity_map"]), expanded=True)
st.json(inline_pred.model_dump(exclude=["heatmap", "affinity_map"]), expanded=True)

if run_inline_det:
det_img, text_pred, inline_pred = inline_detection(pil_image)
Expand Down

0 comments on commit 880fad4

Please sign in to comment.