Spaces:
Runtime error
Runtime error
change in saving engine
Browse files
app.py
CHANGED
|
@@ -15,6 +15,7 @@ def indexing(llm,path=None):
|
|
| 15 |
query_engine = index.as_query_engine()
|
| 16 |
print("all done")
|
| 17 |
print(query_engine)
|
|
|
|
| 18 |
return query_engine
|
| 19 |
|
| 20 |
def qa(sp,engine,message):
|
|
@@ -59,7 +60,7 @@ async def factory():
|
|
| 59 |
cl.user_session.set("sp", sp["output"])
|
| 60 |
else:
|
| 61 |
await cl.Message(author="Beast",content="Okay, then you can start asking your questions!!").send()
|
| 62 |
-
|
| 63 |
|
| 64 |
|
| 65 |
@cl.on_message
|
|
@@ -70,7 +71,7 @@ async def main(message: cl.Message):
|
|
| 70 |
if sp==None:
|
| 71 |
sp=""
|
| 72 |
if not message.elements:
|
| 73 |
-
msg = cl.Message(author="Beast",content=f"
|
| 74 |
await msg.send()
|
| 75 |
response =await cl.make_async(qa)(sp,engine,message)
|
| 76 |
print(response)
|
|
@@ -91,11 +92,12 @@ async def main(message: cl.Message):
|
|
| 91 |
query_engine = await cl.make_async(indexing)(llm,pdf.path)
|
| 92 |
msg.content = f"`{pdf.name}` processed."
|
| 93 |
await msg.update()
|
|
|
|
|
|
|
| 94 |
response =await cl.make_async(qa)(sp,query_engine,message)
|
| 95 |
print(response)
|
| 96 |
msg.content = str(response)
|
| 97 |
-
msg.
|
| 98 |
-
await msg.send()
|
| 99 |
|
| 100 |
|
| 101 |
|
|
|
|
| 15 |
query_engine = index.as_query_engine()
|
| 16 |
print("all done")
|
| 17 |
print(query_engine)
|
| 18 |
+
cl.user_session.set("engine", query_engine)
|
| 19 |
return query_engine
|
| 20 |
|
| 21 |
def qa(sp,engine,message):
|
|
|
|
| 60 |
cl.user_session.set("sp", sp["output"])
|
| 61 |
else:
|
| 62 |
await cl.Message(author="Beast",content="Okay, then you can start asking your questions!!").send()
|
| 63 |
+
|
| 64 |
|
| 65 |
|
| 66 |
@cl.on_message
|
|
|
|
| 71 |
if sp==None:
|
| 72 |
sp=""
|
| 73 |
if not message.elements:
|
| 74 |
+
msg = cl.Message(author="Beast",content=f"Generating Response...", disable_feedback=False)
|
| 75 |
await msg.send()
|
| 76 |
response =await cl.make_async(qa)(sp,engine,message)
|
| 77 |
print(response)
|
|
|
|
| 92 |
query_engine = await cl.make_async(indexing)(llm,pdf.path)
|
| 93 |
msg.content = f"`{pdf.name}` processed."
|
| 94 |
await msg.update()
|
| 95 |
+
msg = cl.Message(author="Beast",content=f"Generating Response...", disable_feedback=False)
|
| 96 |
+
await msg.send()
|
| 97 |
response =await cl.make_async(qa)(sp,query_engine,message)
|
| 98 |
print(response)
|
| 99 |
msg.content = str(response)
|
| 100 |
+
await msg.update()
|
|
|
|
| 101 |
|
| 102 |
|
| 103 |
|