Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,20 +39,14 @@ with st.sidebar:
|
|
| 39 |
st.write('Made with ❤️ by BinDoc GmbH')
|
| 40 |
|
| 41 |
|
| 42 |
-
|
| 43 |
def load_pdf(file_path):
|
| 44 |
pdf_reader = PdfReader(file_path)
|
| 45 |
-
|
| 46 |
for page in pdf_reader.pages:
|
| 47 |
-
text
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
chunk_overlap=200,
|
| 52 |
-
length_function=len
|
| 53 |
-
)
|
| 54 |
-
chunks = text_splitter.split_text(text=text)
|
| 55 |
-
|
| 56 |
store_name = file_path.name[:-4]
|
| 57 |
|
| 58 |
if os.path.exists(f"{store_name}.pkl"):
|
|
@@ -66,6 +60,7 @@ def load_pdf(file_path):
|
|
| 66 |
|
| 67 |
return VectorStore
|
| 68 |
|
|
|
|
| 69 |
def load_chatbot():
|
| 70 |
return load_qa_chain(llm=OpenAI(temperature=0.1, max_tokens=120), chain_type="stuff")
|
| 71 |
|
|
|
|
| 39 |
st.write('Made with ❤️ by BinDoc GmbH')
|
| 40 |
|
| 41 |
|
|
|
|
| 42 |
def load_pdf(file_path):
|
| 43 |
pdf_reader = PdfReader(file_path)
|
| 44 |
+
chunks = []
|
| 45 |
for page in pdf_reader.pages:
|
| 46 |
+
text = page.extract_text()
|
| 47 |
+
if text:
|
| 48 |
+
chunks.append(text)
|
| 49 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
store_name = file_path.name[:-4]
|
| 51 |
|
| 52 |
if os.path.exists(f"{store_name}.pkl"):
|
|
|
|
| 60 |
|
| 61 |
return VectorStore
|
| 62 |
|
| 63 |
+
|
| 64 |
def load_chatbot():
|
| 65 |
return load_qa_chain(llm=OpenAI(temperature=0.1, max_tokens=120), chain_type="stuff")
|
| 66 |
|