dhiraj5678 commited on
Commit
7851bae
1 Parent(s): 4f1f105

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -1
app.py CHANGED
@@ -8,13 +8,23 @@ model = AutoModelForSeq2SeqLM.from_pretrained("facebook/bart-large-cnn")
8
  import streamlit as st
9
  import os
10
 
 
 
11
  uploaded_file = st.file_uploader("Choose a file")
12
  if uploaded_file is not None:
13
  # To read file as bytes:
14
  #bytes_data = uploaded_file.getvalue()
15
  #st.write(bytes_data)
16
  st.write(uploaded_file)
17
-
 
 
 
 
 
 
 
 
18
  # To convert to a string based IO:
19
  #stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
20
  #st.write(stringio)
 
8
  import streamlit as st
9
  import os
10
 
11
+ import PyPDF2
12
+
13
  uploaded_file = st.file_uploader("Choose a file")
14
  if uploaded_file is not None:
15
  # To read file as bytes:
16
  #bytes_data = uploaded_file.getvalue()
17
  #st.write(bytes_data)
18
  st.write(uploaded_file)
19
+ # creating a pdf file object
20
+ pdfFileObj = open(uploaded_file, 'rb')
21
+
22
+ # creating a pdf reader object
23
+ pdfReader = PyPDF2.PdfFileReader(pdfFileObj)
24
+
25
+ # printing number of pages in pdf file
26
+ number_of_pages = pdfReader.numPages
27
+ st.write(number_of_pages)
28
  # To convert to a string based IO:
29
  #stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))
30
  #st.write(stringio)