Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
#
|
15 |
-
|
|
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
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 |
|