async
Browse files- 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 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
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")
|