Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
@@ -481,13 +481,18 @@ async def bing_dalle(item: BingDalle):
|
|
481 |
except requests.exceptions.RequestException:
|
482 |
raise HTTPException(status_code=500, detail="Invalid cookie string, check your cookie string and try again")
|
483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
try:
|
485 |
-
response =
|
486 |
-
|
487 |
-
model=item.model,
|
488 |
-
)
|
489 |
-
return {"status": "true", "sukuna": {"message": response.data[0].url}}
|
490 |
-
|
491 |
except BaseException as e:
|
492 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
493 |
|
|
|
481 |
except requests.exceptions.RequestException:
|
482 |
raise HTTPException(status_code=500, detail="Invalid cookie string, check your cookie string and try again")
|
483 |
|
484 |
+
async def generate_image():
|
485 |
+
try:
|
486 |
+
response = BingImages.images.generate(
|
487 |
+
prompt=item.prompt,
|
488 |
+
model=item.model,
|
489 |
+
)
|
490 |
+
except BaseException as e
|
491 |
+
return {"status": "false", "message": f"Internal Error: {e}"}
|
492 |
+
return response
|
493 |
try:
|
494 |
+
response = await generate_image()
|
495 |
+
return = {"status": "true", "sukuna": {"message": response.data[0].url}}
|
|
|
|
|
|
|
|
|
496 |
except BaseException as e:
|
497 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
498 |
|