Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,12 +22,15 @@ def detect_objects(images):
|
|
| 22 |
|
| 23 |
def create_solutions(image_urls, all_bboxes, all_bboxes2, file_ids):
|
| 24 |
solutions = []
|
|
|
|
| 25 |
img_id = 1
|
| 26 |
box_id = 1
|
| 27 |
category_id = 1
|
| 28 |
for image_url, bboxes, bboxes2, file_id in zip(image_urls, all_bboxes, all_bboxes2, file_ids):
|
| 29 |
ansx=[]
|
|
|
|
| 30 |
for box, box2 in zip(bboxes, bboxes2):
|
|
|
|
| 31 |
if isinstance(box2[0], list):
|
| 32 |
w = box2[0][2]
|
| 33 |
h = box2[0][3]
|
|
@@ -80,7 +83,9 @@ def process_images(params):
|
|
| 80 |
return {"error": f"Error loading images: {str(e)}"}
|
| 81 |
|
| 82 |
all_bboxes, all_bboxes2 = detect_objects(images) # Perform object detection
|
|
|
|
| 83 |
solutions = create_solutions(image_urls, all_bboxes, all_bboxes2, file_id) # Create solutions with image URLs and bounding boxes
|
|
|
|
| 84 |
|
| 85 |
# result_url = f"{api}/{job_id}"
|
| 86 |
# send_results_to_api(solutions, result_url)
|
|
|
|
| 22 |
|
| 23 |
def create_solutions(image_urls, all_bboxes, all_bboxes2, file_ids):
|
| 24 |
solutions = []
|
| 25 |
+
print("creating solutions...")
|
| 26 |
img_id = 1
|
| 27 |
box_id = 1
|
| 28 |
category_id = 1
|
| 29 |
for image_url, bboxes, bboxes2, file_id in zip(image_urls, all_bboxes, all_bboxes2, file_ids):
|
| 30 |
ansx=[]
|
| 31 |
+
print("entering first loop in solution function...")
|
| 32 |
for box, box2 in zip(bboxes, bboxes2):
|
| 33 |
+
print("Entering second loop in solution function")
|
| 34 |
if isinstance(box2[0], list):
|
| 35 |
w = box2[0][2]
|
| 36 |
h = box2[0][3]
|
|
|
|
| 83 |
return {"error": f"Error loading images: {str(e)}"}
|
| 84 |
|
| 85 |
all_bboxes, all_bboxes2 = detect_objects(images) # Perform object detection
|
| 86 |
+
print("detection done...")
|
| 87 |
solutions = create_solutions(image_urls, all_bboxes, all_bboxes2, file_id) # Create solutions with image URLs and bounding boxes
|
| 88 |
+
print("solution created...")
|
| 89 |
|
| 90 |
# result_url = f"{api}/{job_id}"
|
| 91 |
# send_results_to_api(solutions, result_url)
|