Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -89,16 +89,23 @@ def main():
|
|
| 89 |
k1= 5
|
| 90 |
text_list = []
|
| 91 |
causal_sents = []
|
| 92 |
-
|
| 93 |
-
|
| 94 |
try:
|
| 95 |
-
#if uploaded_file is not None:
|
| 96 |
uploaded_file = st.sidebar.file_uploader("Choose a file", type = "pdf")
|
| 97 |
-
#st.stop()
|
| 98 |
except:
|
| 99 |
-
|
| 100 |
st.error("Please upload your own PDF to be analyzed")
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
#except:
|
| 103 |
#if uploaded_file
|
| 104 |
#st.write("Upload a pdf file...")
|
|
@@ -109,6 +116,10 @@ def main():
|
|
| 109 |
for page in reader.pages:
|
| 110 |
text = page.extract_text()
|
| 111 |
text_list.append(text)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
text_list_final = [x.replace('\n', '') for x in text_list]
|
| 113 |
text_list_final = re.sub('"', '', str(text_list_final))
|
| 114 |
|
|
|
|
| 89 |
k1= 5
|
| 90 |
text_list = []
|
| 91 |
causal_sents = []
|
| 92 |
+
|
| 93 |
+
uploaded_file = None
|
| 94 |
try:
|
|
|
|
| 95 |
uploaded_file = st.sidebar.file_uploader("Choose a file", type = "pdf")
|
|
|
|
| 96 |
except:
|
| 97 |
+
uploaded_file = PdfReader('sample_anno.pdf')
|
| 98 |
st.error("Please upload your own PDF to be analyzed")
|
| 99 |
|
| 100 |
+
|
| 101 |
+
# try:
|
| 102 |
+
# #if uploaded_file is not None:
|
| 103 |
+
# uploaded_file = st.sidebar.file_uploader("Choose a file", type = "pdf")
|
| 104 |
+
# #st.stop()
|
| 105 |
+
# except:
|
| 106 |
+
# #uploaded_file = PdfReader('sample_anno.pdf')
|
| 107 |
+
# st.error("Please upload your own PDF to be analyzed")
|
| 108 |
+
|
| 109 |
#except:
|
| 110 |
#if uploaded_file
|
| 111 |
#st.write("Upload a pdf file...")
|
|
|
|
| 116 |
for page in reader.pages:
|
| 117 |
text = page.extract_text()
|
| 118 |
text_list.append(text)
|
| 119 |
+
else:
|
| 120 |
+
st.error("Please upload your own PDF to be analyzed")
|
| 121 |
+
st.stop()
|
| 122 |
+
|
| 123 |
text_list_final = [x.replace('\n', '') for x in text_list]
|
| 124 |
text_list_final = re.sub('"', '', str(text_list_final))
|
| 125 |
|