Mbonea commited on
Commit
937738a
1 Parent(s): cf6722a
Files changed (1) hide show
  1. App/Chat/PoeChatrouter.py +12 -11
App/Chat/PoeChatrouter.py CHANGED
@@ -48,17 +48,18 @@ async def fetch_predictions(data, is_proxied=False):
48
  pass
49
  proxy = ""
50
  else:
51
- try:
52
- async with session.post(
53
- "https://replicate.com/api/predictions",
54
- json=data,
55
- timeout=5,
56
- ) as response:
57
- temp = await response.json()
58
- return temp
59
- except Exception as e:
60
- print("Error fetching", e)
61
- pass
 
62
 
63
 
64
  @chat_router.post("/predictions")
 
48
  pass
49
  proxy = ""
50
  else:
51
+ async with ClientSession() as session:
52
+ try:
53
+ async with session.post(
54
+ "https://replicate.com/api/predictions",
55
+ json=data,
56
+ timeout=5,
57
+ ) as response:
58
+ temp = await response.json()
59
+ return temp
60
+ except Exception as e:
61
+ print("Error fetching", e)
62
+ pass
63
 
64
 
65
  @chat_router.post("/predictions")