Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -276,17 +276,19 @@ async def extract_text_from_mixed_pdf(file_path):
|
|
276 |
return pdf_text
|
277 |
|
278 |
# Function to delete the ChromaDB collection
|
279 |
-
async def delete_chroma_collection():
|
280 |
-
chroma_instance
|
281 |
-
await chroma_instance.delete_collection()
|
282 |
|
283 |
@cl.on_chat_start
|
284 |
async def on_chat_start():
|
285 |
|
286 |
files = None # Initialize variable to store uploaded files
|
287 |
|
|
|
|
|
|
|
288 |
# Delete the existing ChromaDB collection
|
289 |
-
await delete_chroma_collection()
|
290 |
|
291 |
# Wait for the user to upload a file
|
292 |
while files is None:
|
|
|
276 |
return pdf_text
|
277 |
|
278 |
# Function to delete the ChromaDB collection
|
279 |
+
async def delete_chroma_collection(chroma_instance):
|
280 |
+
chroma_instance.delete_collection()
|
|
|
281 |
|
282 |
@cl.on_chat_start
|
283 |
async def on_chat_start():
|
284 |
|
285 |
files = None # Initialize variable to store uploaded files
|
286 |
|
287 |
+
# Initialize ChromaDB
|
288 |
+
chroma_instance = await cl.make_async(Chroma.from_texts)([], None)
|
289 |
+
|
290 |
# Delete the existing ChromaDB collection
|
291 |
+
await delete_chroma_collection(chroma_instance)
|
292 |
|
293 |
# Wait for the user to upload a file
|
294 |
while files is None:
|