Update app.py
Browse files
app.py
CHANGED
@@ -69,11 +69,7 @@ def process_file(file: AskFileResponse):
|
|
69 |
doc.metadata["source"] = f"source_{i}"
|
70 |
return docs
|
71 |
|
72 |
-
|
73 |
-
start_time = time.time()
|
74 |
-
vectorstore.add_documents(docs)
|
75 |
-
elapsed_time = time.time() - start_time
|
76 |
-
print(f"{str(docs)} took {elapsed_time:.2f} seconds")
|
77 |
|
78 |
|
79 |
@cl.on_chat_start
|
@@ -124,7 +120,12 @@ async def on_chat_start():
|
|
124 |
| RunnablePassthrough.assign(context=itemgetter("context"))
|
125 |
| chat_prompt | chat_model
|
126 |
)
|
127 |
-
|
|
|
|
|
|
|
|
|
|
|
128 |
# Let the user know that the system is ready
|
129 |
msg.content = measure_embedding_time(docs)
|
130 |
await msg.update()
|
|
|
69 |
doc.metadata["source"] = f"source_{i}"
|
70 |
return docs
|
71 |
|
72 |
+
|
|
|
|
|
|
|
|
|
73 |
|
74 |
|
75 |
@cl.on_chat_start
|
|
|
120 |
| RunnablePassthrough.assign(context=itemgetter("context"))
|
121 |
| chat_prompt | chat_model
|
122 |
)
|
123 |
+
def measure_embedding_time(docs):
|
124 |
+
start_time = time.time()
|
125 |
+
vectorstore.add_documents(docs)
|
126 |
+
elapsed_time = time.time() - start_time
|
127 |
+
print(f"{str(docs)} took {elapsed_time:.2f} seconds")
|
128 |
+
|
129 |
# Let the user know that the system is ready
|
130 |
msg.content = measure_embedding_time(docs)
|
131 |
await msg.update()
|