Ufoptg commited on
Commit
7ef63fe
1 Parent(s): bb0a805

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +6 -2
main.py CHANGED
@@ -18,6 +18,7 @@
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
 
20
  import asyncio
 
21
  import base64
22
  import json
23
  import logging
@@ -472,6 +473,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",
@@ -503,7 +505,9 @@ async def bing_dalle(item: BingDalle):
503
  except BaseException as e:
504
  return {"status": "false", "message": f"Something went wrong: {e}"}
505
 
506
- return await main()
 
 
507
 
508
 
509
  @app.post("/UFoP/dalle3xl")
@@ -1129,4 +1133,4 @@ def custom_exception_handler(request: Request, exc: HTTPException) -> JSONRespon
1129
 
1130
 
1131
  # Add the custom exception handler to your FastAPI app
1132
- app.add_exception_handler(HTTPException, custom_exception_handler)
 
18
  # along with this program. If not, see <https://www.gnu.org/licenses/>.
19
 
20
  import asyncio
21
+ import nest_asyncio
22
  import base64
23
  import json
24
  import logging
 
473
 
474
  @app.post("/Bing/Dall-E-3")
475
  async def bing_dalle(item: BingDalle):
476
+ nest_asyncio.apply()
477
  try:
478
  set_cookies(
479
  ".bing.com",
 
505
  except BaseException as e:
506
  return {"status": "false", "message": f"Something went wrong: {e}"}
507
 
508
+ response = await main()
509
+ nest_asyncio.unapply()
510
+ return response
511
 
512
 
513
  @app.post("/UFoP/dalle3xl")
 
1133
 
1134
 
1135
  # Add the custom exception handler to your FastAPI app
1136
+ app.add_exception_handler(HTTPException, custom_exception_handler)