sharktide commited on
Commit
f3d208d
·
verified ·
1 Parent(s): c91e60a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -327,7 +327,7 @@ def check_chat_rate_limit(ip: str):
327
 
328
  @app.post("/gen/image")
329
  @app.get("/genimg/{prompt}")
330
- async def generate_image(prompt: str = None, request: Request):
331
  client_ip = request.client.host
332
  check_rate_limit(client_ip)
333
  timeout = httpx.Timeout(300.0, read=300.0)
@@ -524,11 +524,13 @@ async def generate_text(request: Request):
524
 
525
  raise HTTPException(500, "Unknown provider routing error")
526
 
 
527
  @app.post("/gen/sfx")
528
- async def gensfx(request: Request):
529
  client_ip = request.client.host
530
  check_audio_rate_limit(client_ip)
531
- prompt = (await request.json()).prompt
 
532
  url = f"https://gen.pollinations.ai/audio/{prompt}?model=elevenaudio&key={PKEY}"
533
  async with httpx.AsyncClient(timeout=None) as client:
534
  response = await client.get(url)
 
327
 
328
  @app.post("/gen/image")
329
  @app.get("/genimg/{prompt}")
330
+ async def generate_image(request: Request, prompt: str = None):
331
  client_ip = request.client.host
332
  check_rate_limit(client_ip)
333
  timeout = httpx.Timeout(300.0, read=300.0)
 
524
 
525
  raise HTTPException(500, "Unknown provider routing error")
526
 
527
+ @app.get("/gen/sfx")
528
  @app.post("/gen/sfx")
529
+ async def gensfx(request: Request, prompt: string = None):
530
  client_ip = request.client.host
531
  check_audio_rate_limit(client_ip)
532
+ if prompt is None:
533
+ prompt = (await request.json()).prompt
534
  url = f"https://gen.pollinations.ai/audio/{prompt}?model=elevenaudio&key={PKEY}"
535
  async with httpx.AsyncClient(timeout=None) as client:
536
  response = await client.get(url)