Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -15,11 +15,23 @@ import streamlit as st
|
|
15 |
def load_model():
|
16 |
return KeyBERT()
|
17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
st.sidebar.image(
|
19 |
"https://github.com/gizdatalab/policy_tracing/blob/main/img/sdsn.png?raw=true",
|
20 |
use_column_width=True
|
21 |
)
|
22 |
|
|
|
|
|
23 |
st.sidebar.title(
|
24 |
"Options:"
|
25 |
)
|
@@ -56,11 +68,5 @@ st.markdown("## 📌 Step One: Upload document ")
|
|
56 |
with st.container():
|
57 |
|
58 |
file = st.file_uploader('Upload PDF File', type=['pdf'])
|
59 |
-
|
60 |
-
|
61 |
-
with pdfplumber.open(file) as pdf:
|
62 |
-
for page in pdf.pages:
|
63 |
-
text.append(page.extract_text())
|
64 |
-
text_str = ' '.join([page for page in text])
|
65 |
-
|
66 |
-
st.write('Number of pages:',len(pdf.pages))
|
|
|
15 |
def load_model():
|
16 |
return KeyBERT()
|
17 |
|
18 |
+
def read_(file):
|
19 |
+
if file is not None:
|
20 |
+
text = []
|
21 |
+
with pdfplumber.open(file) as pdf:
|
22 |
+
for page in pdf.pages:
|
23 |
+
text.append(page.extract_text())
|
24 |
+
text_str = ' '.join([page for page in text])
|
25 |
+
|
26 |
+
|
27 |
+
|
28 |
st.sidebar.image(
|
29 |
"https://github.com/gizdatalab/policy_tracing/blob/main/img/sdsn.png?raw=true",
|
30 |
use_column_width=True
|
31 |
)
|
32 |
|
33 |
+
st.sidebar.container():
|
34 |
+
file = st.file_uploader('Upload PDF File', type=['pdf'])
|
35 |
st.sidebar.title(
|
36 |
"Options:"
|
37 |
)
|
|
|
68 |
with st.container():
|
69 |
|
70 |
file = st.file_uploader('Upload PDF File', type=['pdf'])
|
71 |
+
text_str = read_(file)
|
72 |
+
st.write('Number of pages:',len(pdf.pages))
|
|
|
|
|
|
|
|
|
|
|
|