Update app.py
Browse files
app.py
CHANGED
@@ -56,42 +56,6 @@ if a == 'PDF':
|
|
56 |
st.write("Process Completed")
|
57 |
|
58 |
|
59 |
-
|
60 |
-
'''
|
61 |
-
if a == 'PDF' :
|
62 |
-
|
63 |
-
uploaded_files = st.file_uploader("Upload files - ", accept_multiple_files=True ,
|
64 |
-
type = ['pdf'] )
|
65 |
-
|
66 |
-
if st.button("Process!"):
|
67 |
-
for i in uploaded_files:
|
68 |
-
if i.type == "application/pdf" :
|
69 |
-
reader = PyPDF2.PdfReader(i)
|
70 |
-
|
71 |
-
text_ext = []
|
72 |
-
for i in range(len(reader.pages)):
|
73 |
-
pageObj = reader.pages[i]
|
74 |
-
# extracting text from page
|
75 |
-
text_ext.append(pageObj.extract_text())
|
76 |
-
|
77 |
-
sent_toks = []
|
78 |
-
for i in text_ext:
|
79 |
-
sent_toks.append(sent_tokenize(i))
|
80 |
-
concat_list = [j for i in sent_toks for j in i]
|
81 |
-
|
82 |
-
filt1_list = []
|
83 |
-
for i in concat_list:
|
84 |
-
a = (i.replace('\n', ' '))
|
85 |
-
filt1_list.append(a)
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
#model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
90 |
-
embeddings = model.encode(filt1_list)
|
91 |
-
|
92 |
-
st.write("Process Completed")
|
93 |
-
'''
|
94 |
-
|
95 |
query = st.text_input('Ask me anything!', placeholder = 'Type.....')
|
96 |
if st.button("Confirm!"):
|
97 |
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
@@ -114,3 +78,37 @@ if a == 'PDF' :
|
|
114 |
|
115 |
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
st.write("Process Completed")
|
57 |
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
query = st.text_input('Ask me anything!', placeholder = 'Type.....')
|
60 |
if st.button("Confirm!"):
|
61 |
model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
|
|
78 |
|
79 |
|
80 |
|
81 |
+
|
82 |
+
# if a == 'PDF' :
|
83 |
+
|
84 |
+
# uploaded_files = st.file_uploader("Upload files - ", accept_multiple_files=True ,
|
85 |
+
# type = ['pdf'] )
|
86 |
+
|
87 |
+
# if st.button("Process!"):
|
88 |
+
# for i in uploaded_files:
|
89 |
+
# if i.type == "application/pdf" :
|
90 |
+
# reader = PyPDF2.PdfReader(i)
|
91 |
+
|
92 |
+
# text_ext = []
|
93 |
+
# for i in range(len(reader.pages)):
|
94 |
+
# pageObj = reader.pages[i]
|
95 |
+
# # extracting text from page
|
96 |
+
# text_ext.append(pageObj.extract_text())
|
97 |
+
|
98 |
+
# sent_toks = []
|
99 |
+
# for i in text_ext:
|
100 |
+
# sent_toks.append(sent_tokenize(i))
|
101 |
+
# concat_list = [j for i in sent_toks for j in i]
|
102 |
+
|
103 |
+
# filt1_list = []
|
104 |
+
# for i in concat_list:
|
105 |
+
# a = (i.replace('\n', ' '))
|
106 |
+
# filt1_list.append(a)
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
# #model = SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')
|
111 |
+
# embeddings = model.encode(filt1_list)
|
112 |
+
|
113 |
+
# st.write("Process Completed")
|
114 |
+
# '''
|