Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ from langchain.llms import HuggingFaceHub
|
|
15 |
def get_pdf_text(pdf_docs):
|
16 |
text = ''
|
17 |
# pdf_file_ = open(pdf_docs,'rb')
|
18 |
-
# text = "example
|
19 |
pdf_reader = PdfReader(pdf_docs)
|
20 |
for page in pdf_reader.pages:
|
21 |
text += page.extract_text()
|
@@ -32,7 +32,7 @@ def get_text_chunks(text):
|
|
32 |
)
|
33 |
# text_splitter = CharacterTextSplitter(
|
34 |
# separator="\n",
|
35 |
-
# chunk_size=
|
36 |
# chunk_overlap=200,
|
37 |
# length_function=len
|
38 |
# )
|
@@ -105,7 +105,7 @@ def get_json_file(docs):
|
|
105 |
# with open(docs, 'r') as f:
|
106 |
json_data = json.load(docs)
|
107 |
|
108 |
-
for f_key, f_value in json_data.items():
|
109 |
for s_value in f_value:
|
110 |
text += str(f_key) + str(s_value)
|
111 |
text += '\n'
|
@@ -139,8 +139,8 @@ def main():
|
|
139 |
st.subheader("Your documents")
|
140 |
docs = st.file_uploader(
|
141 |
"Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
|
142 |
-
if st.button("Process"):
|
143 |
-
with st.spinner("Processing"):
|
144 |
# get pdf text
|
145 |
raw_text = ""
|
146 |
|
@@ -171,7 +171,7 @@ def main():
|
|
171 |
|
172 |
# create vector store
|
173 |
vectorstore = get_vectorstore(text_chunks)
|
174 |
-
|
175 |
# create conversation chain
|
176 |
st.session_state.conversation = get_conversation_chain(
|
177 |
vectorstore)
|
|
|
15 |
def get_pdf_text(pdf_docs):
|
16 |
text = ''
|
17 |
# pdf_file_ = open(pdf_docs,'rb')
|
18 |
+
# text = "example hofjin"
|
19 |
pdf_reader = PdfReader(pdf_docs)
|
20 |
for page in pdf_reader.pages:
|
21 |
text += page.extract_text()
|
|
|
32 |
)
|
33 |
# text_splitter = CharacterTextSplitter(
|
34 |
# separator="\n",
|
35 |
+
# chunk_size=10f00,
|
36 |
# chunk_overlap=200,
|
37 |
# length_function=len
|
38 |
# )
|
|
|
105 |
# with open(docs, 'r') as f:
|
106 |
json_data = json.load(docs)
|
107 |
|
108 |
+
f for f_key, f_value in json_data.items():
|
109 |
for s_value in f_value:
|
110 |
text += str(f_key) + str(s_value)
|
111 |
text += '\n'
|
|
|
139 |
st.subheader("Your documents")
|
140 |
docs = st.file_uploader(
|
141 |
"Upload your PDFs here and click on 'Process'", accept_multiple_files=True)
|
142 |
+
if st.button("Process"):f
|
143 |
+
with st.spinner("Processing"):
|
144 |
# get pdf text
|
145 |
raw_text = ""
|
146 |
|
|
|
171 |
|
172 |
# create vector store
|
173 |
vectorstore = get_vectorstore(text_chunks)
|
174 |
+
f
|
175 |
# create conversation chain
|
176 |
st.session_state.conversation = get_conversation_chain(
|
177 |
vectorstore)
|