Solshine commited on
Commit
29a0691
1 Parent(s): 30dc91e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -7
app.py CHANGED
@@ -11,18 +11,23 @@ uploaded_file = st.file_uploader("Choose a file", "pdf")
11
  if uploaded_file is not None:
12
  # creating a pdf reader object
13
  reader = PdfReader(uploaded_file)
14
- # getting a specific page from the pdf file
15
- pages = reader.pages
 
16
 
17
- # extracting text from page
18
- text = page.extract_text()
19
- print("Created text")
20
- with st.popover("Open popover"):
 
 
 
21
  sound_file = BytesIO()
22
  tts = gTTS(text, lang='en')
23
  tts.write_to_fp(sound_file)
24
-
25
  st.audio(sound_file)
 
26
 
27
 
28
 
 
11
  if uploaded_file is not None:
12
  # creating a pdf reader object
13
  reader = PdfReader(uploaded_file)
14
+ # printing number of pages in pdf file
15
+ X = len(reader.pages)
16
+ print(X)
17
 
18
+ i = 0
19
+ while i <= X:
20
+ # getting a specific page from the pdf file
21
+ page = reader.pages[i]
22
+ # extracting text from page
23
+ text = page.extract_text()
24
+ print("Created text of page" i )
25
  sound_file = BytesIO()
26
  tts = gTTS(text, lang='en')
27
  tts.write_to_fp(sound_file)
28
+ i = i + 1
29
  st.audio(sound_file)
30
+ print("transcribed" i "pages" of X "total pages.")
31
 
32
 
33