Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -500,14 +500,13 @@ async def bing_dalle(item: BingDalle):
|
|
500 |
|
501 |
try:
|
502 |
response = await generate_image(item.prompt, item.model)
|
503 |
-
return {"status": "true", "sukuna": {"message": response}}
|
504 |
# Check if response contains the expected data
|
505 |
if 'data' in response and response['data']:
|
506 |
# Assuming the URL is stored in 'url' key of the first item
|
507 |
image_url = response['data'][0]['url']
|
508 |
return {"status": "true", "sukuna": {"message": image_url}}
|
509 |
else:
|
510 |
-
return {"status": "false", "message": "No image URL found in the response"}
|
511 |
except BaseException as e:
|
512 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
513 |
|
|
|
500 |
|
501 |
try:
|
502 |
response = await generate_image(item.prompt, item.model)
|
|
|
503 |
# Check if response contains the expected data
|
504 |
if 'data' in response and response['data']:
|
505 |
# Assuming the URL is stored in 'url' key of the first item
|
506 |
image_url = response['data'][0]['url']
|
507 |
return {"status": "true", "sukuna": {"message": image_url}}
|
508 |
else:
|
509 |
+
return {"status": "false", "message": f"No image URL found in the {response}"}
|
510 |
except BaseException as e:
|
511 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
512 |
|