Hello everyone,
I deployed a chatbot app on Streamlit, and it was working well. However, it suddenly encountered an error:
FileNotFoundError: [Errno 2] No such file or directory: ‘pdfinfo’
pdf2image.exceptions.PDFInfoNotInstalledError
: Unable to get page count. Is poppler installed and in PATH?
Upon researching this issue online, I found suggestions to add poppler-utils
to packages.txt
and pdf2image
to requirements.txt
. I followed these instructions, but unfortunately, the problem persists.
This is my code :
st.header("Support Client 💬 📚")
if "messages" not in st.session_state.keys():
st.session_state.messages = [
{"role": "assistant", "content": "Ask me a question"}
]
@st.cache_resource(show_spinner=False)
def load_data():
with st.spinner(text="Loading information "):
loader = DirectoryLoader("DOCUMENTS/")
index = VectorstoreIndexCreator().from_loaders([loader])
return index
index = load_data()
if prompt := st.chat_input("Your question"):
st.session_state.messages.append({"role": "user", "content": prompt})
for message in st.session_state.messages:
with st.chat_message(message["role"]):
st.write(message["content"])
if st.session_state.messages[-1]["role"] != "assistant":
with st.chat_message("assistant"):
with st.spinner("Thinking..."):
response = index.query(prompt, llm = ChatOpenAI(model="gpt-4-1106-preview"))
st.write(response)
message = {"role": "assistant", "content": response}
st.session_state.messages.append(message)
Before, I successfully deployed and used the chatbot app. However, the error suddenly appeared recently.