Update app.py
Browse files
app.py
CHANGED
@@ -45,19 +45,24 @@ import urllib # the lib that handles the url stuff
|
|
45 |
from PyPDF2 import PdfReader
|
46 |
text_list = []
|
47 |
|
48 |
-
target_url = 'https://huggingface.co/datasets/Seetha/Visualization/raw/main/AFLAC_Wyatt_notag.pdf'
|
|
|
49 |
if st.button('PDF1'):
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
|
|
|
|
|
|
|
|
62 |
else:
|
63 |
st.write('Goodbye')
|
|
|
45 |
from PyPDF2 import PdfReader
|
46 |
text_list = []
|
47 |
|
48 |
+
#target_url = 'https://huggingface.co/datasets/Seetha/Visualization/raw/main/AFLAC_Wyatt_notag.pdf'
|
49 |
+
file_path = "AFLAC_Wyatt_notag.pdf"
|
50 |
if st.button('PDF1'):
|
51 |
+
with open(file_path,"rb") as f:
|
52 |
+
base64_pdf = base64.b64encode(f.read()).decode('utf-8')
|
53 |
+
pdf_display = f'<iframe src="data:application/pdf;base64,{base64_pdf}" width="800" height="800" type="application/pdf"></iframe>'
|
54 |
+
st.markdown(pdf_display, unsafe_allow_html=True)
|
55 |
+
# data = urllib.request.urlopen(target_url)
|
56 |
+
# for line in data.read():
|
57 |
+
# st.write(line)
|
58 |
+
# if data is not None:
|
59 |
+
# reader = PdfReader(data)
|
60 |
+
# for page in reader.pages:
|
61 |
+
# text = page.extract_text()
|
62 |
+
# text_list.append(text)
|
63 |
+
# st.write(text_list)
|
64 |
+
# else:
|
65 |
+
# st.error("Please upload your own PDF to be analyzed")
|
66 |
+
# st.stop()
|
67 |
else:
|
68 |
st.write('Goodbye')
|