Spaces:
Running
on
T4
Running
on
T4
Update app.py
Browse files
app.py
CHANGED
@@ -40,9 +40,15 @@ def text_line_detection_function(img):
|
|
40 |
print("Text Line Detection Function Called")
|
41 |
preds = batch_detection([img], det_model, det_processor)[0] # Assuming this returns a DetectionResult object
|
42 |
print(f"Detection Predictions: {preds}")
|
43 |
-
|
44 |
-
|
45 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
|
48 |
with gr.Blocks() as app:
|
|
|
40 |
print("Text Line Detection Function Called")
|
41 |
preds = batch_detection([img], det_model, det_processor)[0] # Assuming this returns a DetectionResult object
|
42 |
print(f"Detection Predictions: {preds}")
|
43 |
+
|
44 |
+
# Check if preds has an attribute 'bboxes' and use it
|
45 |
+
if hasattr(preds, 'bboxes'):
|
46 |
+
# Assuming draw_polys_on_image can work with the format of bboxes directly or you adapt it accordingly
|
47 |
+
img_with_lines = draw_polys_on_image([bbox.polygon for bbox in preds.bboxes], img)
|
48 |
+
return img_with_lines, preds
|
49 |
+
else:
|
50 |
+
raise AttributeError("DetectionResult object does not have 'bboxes' attribute")
|
51 |
+
|
52 |
|
53 |
|
54 |
with gr.Blocks() as app:
|