Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ figure_class_index = 3 # class index for figures
|
|
15 |
table_class_index = 4 # class index for tables
|
16 |
|
17 |
# Function to perform inference on an image and return bounding boxes for figures and tables
|
18 |
-
|
19 |
def infer_image_and_get_boxes(image, confidence_threshold=0.6):
|
20 |
results = model.predict(image)
|
21 |
boxes = [
|
@@ -26,7 +26,7 @@ def infer_image_and_get_boxes(image, confidence_threshold=0.6):
|
|
26 |
return boxes
|
27 |
|
28 |
# Function to crop images from the boxes
|
29 |
-
|
30 |
def crop_images_from_boxes(image, boxes, scale_factor):
|
31 |
cropped_images = [
|
32 |
image[int(y1 * scale_factor):int(y2 * scale_factor), int(x1 * scale_factor):int(x2 * scale_factor)]
|
|
|
15 |
table_class_index = 4 # class index for tables
|
16 |
|
17 |
# Function to perform inference on an image and return bounding boxes for figures and tables
|
18 |
+
|
19 |
def infer_image_and_get_boxes(image, confidence_threshold=0.6):
|
20 |
results = model.predict(image)
|
21 |
boxes = [
|
|
|
26 |
return boxes
|
27 |
|
28 |
# Function to crop images from the boxes
|
29 |
+
|
30 |
def crop_images_from_boxes(image, boxes, scale_factor):
|
31 |
cropped_images = [
|
32 |
image[int(y1 * scale_factor):int(y2 * scale_factor), int(x1 * scale_factor):int(x2 * scale_factor)]
|