Ufoptg commited on
Commit
bef5b62
1 Parent(s): e95e6ac

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +12 -0
main.py CHANGED
@@ -152,6 +152,17 @@ def validate_api_key_only_devs(api_key: str = Header(...)):
152
  if api_key not in ONLY_DEVELOPER_API_KEYS:
153
  raise HTTPException(status_code=401, detail="Invalid API key")
154
 
 
 
 
 
 
 
 
 
 
 
 
155
 
156
  RAMDOM_STATUS = [
157
  "Spammer",
@@ -587,6 +598,7 @@ async def gemini_pro(item: GeminiPro):
587
 
588
  BingImages = BingClient()
589
 
 
590
  @app.post("/Bing/Dall-E-3")
591
  async def bing_dalle(item: BingDalle):
592
  try:
 
152
  if api_key not in ONLY_DEVELOPER_API_KEYS:
153
  raise HTTPException(status_code=401, detail="Invalid API key")
154
 
155
+ def asyncioPoliciesFix(func):
156
+ def wrapper(*args):
157
+ if (
158
+ sys.version_info[0] == 3
159
+ and sys.version_info[1] >= 8
160
+ and sys.platform.startswith("win")
161
+ ):
162
+ asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
163
+ return func(*args)
164
+
165
+ return wrapper
166
 
167
  RAMDOM_STATUS = [
168
  "Spammer",
 
598
 
599
  BingImages = BingClient()
600
 
601
+ @asyncioPoliciesFix
602
  @app.post("/Bing/Dall-E-3")
603
  async def bing_dalle(item: BingDalle):
604
  try: