D3V1L1810 commited on
Commit
af00786
·
verified ·
1 Parent(s): 05851a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -25,11 +25,11 @@ def detect_objects(images):
25
  print(names)
26
  return names
27
 
28
- def create_solutions(image_urls, names):
29
  solutions = [] #list to store all the objects
30
 
31
- for image_url, class_name in zip(image_urls, names):
32
- obj = {"url": image_url, "answer": [class_name], "qcUser" : None }
33
  solutions.append(obj)
34
  return solutions
35
 
@@ -50,6 +50,7 @@ def process_images(params):
50
  return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
51
 
52
  image_urls = params.get("urls", [])
 
53
  # api = params.get("api", "")
54
  # job_id = params.get("job_id", "")
55
 
@@ -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)
 
25
  print(names)
26
  return names
27
 
28
+ def create_solutions(image_urls, names, file_ids):
29
  solutions = [] #list to store all the objects
30
 
31
+ for image_url, class_name, file_id in zip(image_urls, names, file_ids):
32
+ obj = {"url": image_url, "answer": [class_name], "qcUser" : None, "normalfileID" : file_id }
33
  solutions.append(obj)
34
  return solutions
35
 
 
50
  return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
51
 
52
  image_urls = params.get("urls", [])
53
+ file_id = params.get("normalfileID", [])
54
  # api = params.get("api", "")
55
  # job_id = params.get("job_id", "")
56
 
 
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)