Spaces:
Paused
Paused
Update main.py
Browse files
main.py
CHANGED
|
@@ -481,18 +481,19 @@ 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 |
-
async def generate_image():
|
| 485 |
try:
|
| 486 |
response = BingImages.images.generate(
|
| 487 |
-
prompt=
|
| 488 |
-
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 |
-
|
|
|
|
| 496 |
except BaseException as e:
|
| 497 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
| 498 |
|
|
|
|
| 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(prompt, model):
|
| 485 |
try:
|
| 486 |
response = BingImages.images.generate(
|
| 487 |
+
prompt=prompt,
|
| 488 |
+
model=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(item.prompt, item.model)
|
| 495 |
+
image_url = response.data[0].url
|
| 496 |
+
return {"status": "true", "sukuna": {"message": image_url}}
|
| 497 |
except BaseException as e:
|
| 498 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
| 499 |
|