Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -476,6 +476,7 @@ async def bing_dalle(item: BingDalle):
|
|
476 |
BingImages = await BingClient(image_provider=BingCreateImages)
|
477 |
except Exception:
|
478 |
pass
|
|
|
479 |
try:
|
480 |
set_cookies(
|
481 |
".bing.com",
|
@@ -494,11 +495,19 @@ async def bing_dalle(item: BingDalle):
|
|
494 |
)
|
495 |
except BaseException as e:
|
496 |
return {"status": "false", "message": f"Internal Error: {e}"}
|
|
|
497 |
return response
|
|
|
498 |
try:
|
499 |
response = await generate_image(item.prompt, item.model)
|
500 |
-
|
501 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
except BaseException as e:
|
503 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
504 |
|
|
|
476 |
BingImages = await BingClient(image_provider=BingCreateImages)
|
477 |
except Exception:
|
478 |
pass
|
479 |
+
|
480 |
try:
|
481 |
set_cookies(
|
482 |
".bing.com",
|
|
|
495 |
)
|
496 |
except BaseException as e:
|
497 |
return {"status": "false", "message": f"Internal Error: {e}"}
|
498 |
+
|
499 |
return response
|
500 |
+
|
501 |
try:
|
502 |
response = await generate_image(item.prompt, item.model)
|
503 |
+
|
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 |
|