Spaces:
Sleeping
Sleeping
fix to handle state.db being intied properly in process_pdf function
Browse files
app.py
CHANGED
|
@@ -54,9 +54,12 @@ class PDFChatbot:
|
|
| 54 |
shutil.rmtree(self.state.vector_store_path)
|
| 55 |
gr.Error(f"An error occurred: {str(e)}")
|
| 56 |
|
|
|
|
|
|
|
|
|
|
| 57 |
def chat_with_pdf(self, message, history):
|
| 58 |
-
if not self.
|
| 59 |
-
yield "
|
| 60 |
return
|
| 61 |
|
| 62 |
retriever = self.state.db.as_retriever()
|
|
|
|
| 54 |
shutil.rmtree(self.state.vector_store_path)
|
| 55 |
gr.Error(f"An error occurred: {str(e)}")
|
| 56 |
|
| 57 |
+
def is_db_ready(self):
|
| 58 |
+
return self.state.db is not None
|
| 59 |
+
|
| 60 |
def chat_with_pdf(self, message, history):
|
| 61 |
+
if not self.is_db_ready():
|
| 62 |
+
yield "Error: Database not ready."
|
| 63 |
return
|
| 64 |
|
| 65 |
retriever = self.state.db.as_retriever()
|