Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -472,7 +472,7 @@ def gemini_pro(item: GeminiPro):
|
|
472 |
|
473 |
@app.post("/Bing/Dall-E-3")
|
474 |
async def bing_dalle(item: BingDalle):
|
475 |
-
try:
|
476 |
set_cookies(
|
477 |
".bing.com",
|
478 |
{
|
@@ -484,16 +484,14 @@ async def bing_dalle(item: BingDalle):
|
|
484 |
|
485 |
async def generate_image(model, prompt):
|
486 |
try:
|
487 |
-
|
488 |
-
response = await BingCreateImages().create_async(
|
489 |
-
# model=model,
|
490 |
-
prompt=prompt,
|
491 |
-
)
|
492 |
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
|
|
|
|
497 |
except BaseException as e:
|
498 |
return {"status": "false", "message": f"Internal Error: {e}"}
|
499 |
|
@@ -504,7 +502,6 @@ async def bing_dalle(item: BingDalle):
|
|
504 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
505 |
|
506 |
|
507 |
-
|
508 |
@app.post("/UFoP/dalle3xl")
|
509 |
def dalle_3xl(item: Dalle3XL, api_key: None = Depends(validate_api_key)):
|
510 |
API_URL = SOURCE_DALLE3XL_URL
|
|
|
472 |
|
473 |
@app.post("/Bing/Dall-E-3")
|
474 |
async def bing_dalle(item: BingDalle):
|
475 |
+
try:
|
476 |
set_cookies(
|
477 |
".bing.com",
|
478 |
{
|
|
|
484 |
|
485 |
async def generate_image(model, prompt):
|
486 |
try:
|
487 |
+
response = await BingCreateImages().create_async(prompt=prompt)
|
|
|
|
|
|
|
|
|
488 |
|
489 |
+
image_data = response.get('data')
|
490 |
+
if image_data:
|
491 |
+
image_url = image_data[0].get('url')
|
492 |
+
return {"status": "true", "sukuna": {"message": image_url}}
|
493 |
+
else:
|
494 |
+
return {"status": "false", "message": "No image URL found in the response"}
|
495 |
except BaseException as e:
|
496 |
return {"status": "false", "message": f"Internal Error: {e}"}
|
497 |
|
|
|
502 |
return {"status": "false", "message": f"Something went wrong: {e}"}
|
503 |
|
504 |
|
|
|
505 |
@app.post("/UFoP/dalle3xl")
|
506 |
def dalle_3xl(item: Dalle3XL, api_key: None = Depends(validate_api_key)):
|
507 |
API_URL = SOURCE_DALLE3XL_URL
|