Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,6 +57,7 @@ def process_images(params):
|
|
| 57 |
except json.JSONDecodeError as e:
|
| 58 |
logging.error(f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}")
|
| 59 |
return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
|
|
|
|
| 60 |
image_urls = params.get("urls", [])
|
| 61 |
# api = params.get("api", "")
|
| 62 |
# job_id = params.get("job_id", "")
|
|
@@ -64,6 +65,7 @@ def process_images(params):
|
|
| 64 |
if not image_urls:
|
| 65 |
logging.error("Missing required parameters: 'urls'")
|
| 66 |
return {"error": "Missing required parameters: 'urls'"}
|
|
|
|
| 67 |
try:
|
| 68 |
images = [Image.open(requests.get(url, stream=True).raw) for url in image_urls] # images from URLs
|
| 69 |
except Exception as e:
|
|
|
|
| 57 |
except json.JSONDecodeError as e:
|
| 58 |
logging.error(f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}")
|
| 59 |
return {"error": f"Invalid JSON input: {e.msg} at line {e.lineno} column {e.colno}"}
|
| 60 |
+
|
| 61 |
image_urls = params.get("urls", [])
|
| 62 |
# api = params.get("api", "")
|
| 63 |
# job_id = params.get("job_id", "")
|
|
|
|
| 65 |
if not image_urls:
|
| 66 |
logging.error("Missing required parameters: 'urls'")
|
| 67 |
return {"error": "Missing required parameters: 'urls'"}
|
| 68 |
+
|
| 69 |
try:
|
| 70 |
images = [Image.open(requests.get(url, stream=True).raw) for url in image_urls] # images from URLs
|
| 71 |
except Exception as e:
|