Spaces:
Sleeping
Sleeping
ankush-003
commited on
Commit
•
bf15aa4
1
Parent(s):
45166fe
asyncio fix
Browse files- app.py +2 -4
- requirements.txt +2 -1
app.py
CHANGED
@@ -16,11 +16,9 @@ from langchain.output_parsers import ResponseSchema, StructuredOutputParser
|
|
16 |
from langchain_core.runnables.history import RunnableWithMessageHistory
|
17 |
from langchain_core.chat_history import BaseChatMessageHistory
|
18 |
from langchain.chains import RetrievalQA
|
19 |
-
import nest_asyncio
|
20 |
-
nest_asyncio.apply()
|
21 |
-
|
22 |
import pymongo
|
23 |
import logging
|
|
|
24 |
import nest_asyncio
|
25 |
from langchain.docstore.document import Document
|
26 |
import redis
|
@@ -96,7 +94,7 @@ async def listen_to_alerts(r):
|
|
96 |
# Start Redis listener in a separate thread
|
97 |
def start_redis_listener():
|
98 |
try:
|
99 |
-
|
100 |
except Exception as e:
|
101 |
print(f"Error in Redis listener: {e}")
|
102 |
|
|
|
16 |
from langchain_core.runnables.history import RunnableWithMessageHistory
|
17 |
from langchain_core.chat_history import BaseChatMessageHistory
|
18 |
from langchain.chains import RetrievalQA
|
|
|
|
|
|
|
19 |
import pymongo
|
20 |
import logging
|
21 |
+
import asyncio
|
22 |
import nest_asyncio
|
23 |
from langchain.docstore.document import Document
|
24 |
import redis
|
|
|
94 |
# Start Redis listener in a separate thread
|
95 |
def start_redis_listener():
|
96 |
try:
|
97 |
+
asyncio.run(listen_to_alerts(r))
|
98 |
except Exception as e:
|
99 |
print(f"Error in Redis listener: {e}")
|
100 |
|
requirements.txt
CHANGED
@@ -6,4 +6,5 @@ langchain
|
|
6 |
langchain-groq
|
7 |
motor
|
8 |
streamlit
|
9 |
-
nest-asyncio
|
|
|
|
6 |
langchain-groq
|
7 |
motor
|
8 |
streamlit
|
9 |
+
nest-asyncio
|
10 |
+
asyncio
|