D3V1L1810 commited on
Commit
420bbd9
·
verified ·
1 Parent(s): 4d4931e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -23,11 +23,11 @@ def detect_objects(images):
23
  names.append(arr)
24
  return names
25
 
26
- def create_solutions(image_urls, names):
27
  solutions = [] #list to store all the objects
28
 
29
- for image_url, class_name in zip(image_urls, names):
30
- obj = {"url": image_url, "answer": [class_name], "qcUser" : None }
31
  solutions.append(obj)
32
  print("object prepared")
33
  return solutions
@@ -49,6 +49,7 @@ def process_images(params):
49
  return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
50
 
51
  image_urls = params.get("urls", [])
 
52
  # api = params.get("api", "")
53
  # job_id = params.get("job_id", "")
54
 
@@ -64,7 +65,7 @@ def process_images(params):
64
  return {"error": f"Error loading images: {str(e)}"}
65
 
66
  names = detect_objects(images) # Perform object detection
67
- solutions = create_solutions(image_urls, names) # Create solutions with image URLs and bounding boxes
68
 
69
  # result_url = f"{api}/{job_id}"
70
  # send_results_to_api(solutions, result_url)
 
23
  names.append(arr)
24
  return names
25
 
26
+ def create_solutions(image_urls, names, file_ids):
27
  solutions = [] #list to store all the objects
28
 
29
+ for image_url, class_name, file_id in zip(image_urls, names, file_ids):
30
+ obj = {"url": image_url, "answer": [class_name], "qcUser" : None, "normalfileID": file_id}
31
  solutions.append(obj)
32
  print("object prepared")
33
  return solutions
 
49
  return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
50
 
51
  image_urls = params.get("urls", [])
52
+ file_id = 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_id) # Create solutions with image URLs and bounding boxes
69
 
70
  # result_url = f"{api}/{job_id}"
71
  # send_results_to_api(solutions, result_url)