Spaces:
Build error
Build error
update source
Browse files
app.py
CHANGED
|
@@ -55,16 +55,18 @@ def main():
|
|
| 55 |
processing_time = time.perf_counter() - start
|
| 56 |
st.write(f"Box detection took {processing_time:.2f} seconds.")
|
| 57 |
|
| 58 |
-
for box in boxes:
|
| 59 |
org_image = cv2.polylines(org_image, [box.astype(np.int32)], isClosed=True, color=(0, 255, 0), thickness=2)
|
| 60 |
image = transform_image(org_image, box)
|
| 61 |
images.append(image)
|
| 62 |
|
|
|
|
|
|
|
| 63 |
texts = text_engine(images)
|
| 64 |
|
| 65 |
# Convert back to PIL Image for displaying
|
| 66 |
output_image = Image.fromarray(cv2.cvtColor(org_image, cv2.COLOR_BGR2RGB))
|
| 67 |
-
|
| 68 |
st.write("Extracted Texts:")
|
| 69 |
st.write(texts)
|
| 70 |
|
|
|
|
| 55 |
processing_time = time.perf_counter() - start
|
| 56 |
st.write(f"Box detection took {processing_time:.2f} seconds.")
|
| 57 |
|
| 58 |
+
for box in boxes[::-1]:
|
| 59 |
org_image = cv2.polylines(org_image, [box.astype(np.int32)], isClosed=True, color=(0, 255, 0), thickness=2)
|
| 60 |
image = transform_image(org_image, box)
|
| 61 |
images.append(image)
|
| 62 |
|
| 63 |
+
st.image(output_image, caption='Detected Text Boxes', use_column_width=True)
|
| 64 |
+
|
| 65 |
texts = text_engine(images)
|
| 66 |
|
| 67 |
# Convert back to PIL Image for displaying
|
| 68 |
output_image = Image.fromarray(cv2.cvtColor(org_image, cv2.COLOR_BGR2RGB))
|
| 69 |
+
|
| 70 |
st.write("Extracted Texts:")
|
| 71 |
st.write(texts)
|
| 72 |
|