Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import sys
|
2 |
import os
|
3 |
import re
|
4 |
-
import
|
5 |
import time
|
6 |
-
|
7 |
sys.path.append(os.path.abspath("."))
|
8 |
from langchain.chains import ConversationalRetrievalChain
|
9 |
from langchain.memory import ConversationBufferMemory
|
@@ -22,6 +22,14 @@ if not OPENAI_API_KEY:
|
|
22 |
st.error("Critical Error: OpenAI API key not found in the environment variables. Please configure it.")
|
23 |
st.stop()
|
24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
def load_docs(document_path):
|
26 |
loader = UnstructuredPDFLoader(document_path)
|
27 |
documents = loader.load()
|
|
|
1 |
import sys
|
2 |
import os
|
3 |
import re
|
4 |
+
import shutil
|
5 |
import time
|
6 |
+
import streamlit as st
|
7 |
sys.path.append(os.path.abspath("."))
|
8 |
from langchain.chains import ConversationalRetrievalChain
|
9 |
from langchain.memory import ConversationBufferMemory
|
|
|
22 |
st.error("Critical Error: OpenAI API key not found in the environment variables. Please configure it.")
|
23 |
st.stop()
|
24 |
|
25 |
+
def check_poppler_installed():
|
26 |
+
if not shutil.which("pdfinfo"):
|
27 |
+
raise EnvironmentError(
|
28 |
+
"Poppler is not installed or not in PATH. Install 'poppler-utils' for PDF processing."
|
29 |
+
)
|
30 |
+
|
31 |
+
check_poppler_installed()
|
32 |
+
|
33 |
def load_docs(document_path):
|
34 |
loader = UnstructuredPDFLoader(document_path)
|
35 |
documents = loader.load()
|