Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,7 +46,10 @@ def process_images(params):
|
|
| 46 |
return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
|
| 47 |
|
| 48 |
image_urls = params.get("urls", [])
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
| 50 |
# api = params.get("api", "")
|
| 51 |
# job_id = params.get("job_id", "")
|
| 52 |
|
|
@@ -62,7 +65,7 @@ def process_images(params):
|
|
| 62 |
return {"error": f"Error loading images: {str(e)}"}
|
| 63 |
|
| 64 |
names = detect_objects(images) # Perform object detection
|
| 65 |
-
solutions = create_solutions(image_urls, names,
|
| 66 |
print("prediction done")
|
| 67 |
|
| 68 |
# result_url = f"{api}/{job_id}"
|
|
|
|
| 46 |
return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
|
| 47 |
|
| 48 |
image_urls = params.get("urls", [])
|
| 49 |
+
if not params.get("normalfileID",[]):
|
| 50 |
+
file_ids = [None]*len(image_urls)
|
| 51 |
+
else:
|
| 52 |
+
file_ids = params.get("normalfileID",[])
|
| 53 |
# api = params.get("api", "")
|
| 54 |
# job_id = params.get("job_id", "")
|
| 55 |
|
|
|
|
| 65 |
return {"error": f"Error loading images: {str(e)}"}
|
| 66 |
|
| 67 |
names = detect_objects(images) # Perform object detection
|
| 68 |
+
solutions = create_solutions(image_urls, names, file_ids) # Create solutions with image URLs and bounding boxes
|
| 69 |
print("prediction done")
|
| 70 |
|
| 71 |
# result_url = f"{api}/{job_id}"
|