Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -487,13 +487,19 @@ async def bing_dalle(item: BingDalle):
|
|
487 |
prompt=prompt,
|
488 |
model=model,
|
489 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
except BaseException as e:
|
491 |
return {"status": "false", "message": f"Internal Error: {e}"}
|
492 |
-
|
493 |
try:
|
494 |
response = await generate_image(item.prompt, item.model)
|
495 |
-
|
496 |
-
return {"status": "true", "sukuna": {"message": image_url}}
|
497 |
except BaseException as e:
|
498 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
499 |
|
|
|
487 |
prompt=prompt,
|
488 |
model=model,
|
489 |
)
|
490 |
+
|
491 |
+
image_url = response.get('data', [])[0].get('url')
|
492 |
+
return {"status": "true", "sukuna": {"message": image_url}}
|
493 |
+
except BingImagesException as e:
|
494 |
+
return {"status": "false", "message": f"BingImages Error: {e}"}
|
495 |
+
except IndexError:
|
496 |
+
return {"status": "false", "message": "No image URL found in the response"}
|
497 |
except BaseException as e:
|
498 |
return {"status": "false", "message": f"Internal Error: {e}"}
|
499 |
+
|
500 |
try:
|
501 |
response = await generate_image(item.prompt, item.model)
|
502 |
+
return response
|
|
|
503 |
except BaseException as e:
|
504 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
505 |
|