Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,7 +22,9 @@ def read_(file):
|
|
| 22 |
for page in pdf.pages:
|
| 23 |
text.append(page.extract_text())
|
| 24 |
text_str = ' '.join([page for page in text])
|
|
|
|
| 25 |
st.write('Number of pages:',len(pdf.pages))
|
|
|
|
| 26 |
return text_str
|
| 27 |
|
| 28 |
|
|
@@ -31,6 +33,8 @@ st.sidebar.image(
|
|
| 31 |
"https://github.com/gizdatalab/policy_tracing/blob/main/img/sdsn.png?raw=true",
|
| 32 |
use_column_width=True
|
| 33 |
)
|
|
|
|
|
|
|
| 34 |
with st.sidebar:
|
| 35 |
file = st.file_uploader('Upload PDF File', type=['pdf'])
|
| 36 |
|
|
@@ -68,7 +72,7 @@ st.markdown("## π Step One: Upload document ")
|
|
| 68 |
|
| 69 |
|
| 70 |
with st.container():
|
| 71 |
-
|
| 72 |
##file = st.file_uploader('Upload PDF File', type=['pdf'])
|
| 73 |
text_str = read_(file)
|
| 74 |
|
|
|
|
| 22 |
for page in pdf.pages:
|
| 23 |
text.append(page.extract_text())
|
| 24 |
text_str = ' '.join([page for page in text])
|
| 25 |
+
st.write('Document:', pdf.metadata
|
| 26 |
st.write('Number of pages:',len(pdf.pages))
|
| 27 |
+
pdf.close()
|
| 28 |
return text_str
|
| 29 |
|
| 30 |
|
|
|
|
| 33 |
"https://github.com/gizdatalab/policy_tracing/blob/main/img/sdsn.png?raw=true",
|
| 34 |
use_column_width=True
|
| 35 |
)
|
| 36 |
+
st.sidebar.markdown("## π Step One: Upload document ")
|
| 37 |
+
|
| 38 |
with st.sidebar:
|
| 39 |
file = st.file_uploader('Upload PDF File', type=['pdf'])
|
| 40 |
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
with st.container():
|
| 75 |
+
st.markdown("## π Step One: Upload document ")
|
| 76 |
##file = st.file_uploader('Upload PDF File', type=['pdf'])
|
| 77 |
text_str = read_(file)
|
| 78 |
|