Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,8 +49,8 @@ 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("image_urls", [])
|
| 52 |
-
api = params.get("api", "")
|
| 53 |
-
job_id = params.get("job_id", "")
|
| 54 |
|
| 55 |
if not image_urls or not api or not job_id:
|
| 56 |
logging.error("Missing required parameters: 'image_urls', 'api', or 'job_id'")
|
|
@@ -65,12 +65,12 @@ def process_images(params):
|
|
| 65 |
names = detect_objects(images)
|
| 66 |
solutions = create_solutions(image_urls, names)
|
| 67 |
|
| 68 |
-
result_url = f"{api}/{job_id}"
|
| 69 |
# response = send_results_to_api(solutions, result_url)
|
| 70 |
|
| 71 |
return json.dumps({"solutions": solutions})
|
| 72 |
|
| 73 |
-
inputt = gr.Textbox(label="Parameters (JSON format) Eg. {'image_urls':['a.jpg','b.jpg']
|
| 74 |
outputs = gr.JSON()
|
| 75 |
|
| 76 |
application = gr.Interface(fn=process_images, inputs=inputt, outputs=outputs, title="Car Colour Classification with API Integration")
|
|
|
|
| 49 |
return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
|
| 50 |
|
| 51 |
image_urls = params.get("image_urls", [])
|
| 52 |
+
# api = params.get("api", "")
|
| 53 |
+
# job_id = params.get("job_id", "")
|
| 54 |
|
| 55 |
if not image_urls or not api or not job_id:
|
| 56 |
logging.error("Missing required parameters: 'image_urls', 'api', or 'job_id'")
|
|
|
|
| 65 |
names = detect_objects(images)
|
| 66 |
solutions = create_solutions(image_urls, names)
|
| 67 |
|
| 68 |
+
# result_url = f"{api}/{job_id}"
|
| 69 |
# response = send_results_to_api(solutions, result_url)
|
| 70 |
|
| 71 |
return json.dumps({"solutions": solutions})
|
| 72 |
|
| 73 |
+
inputt = gr.Textbox(label="Parameters (JSON format) Eg. {'image_urls':['a.jpg','b.jpg']}")
|
| 74 |
outputs = gr.JSON()
|
| 75 |
|
| 76 |
application = gr.Interface(fn=process_images, inputs=inputt, outputs=outputs, title="Car Colour Classification with API Integration")
|