Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -12,22 +12,21 @@ st.write(slider_reply)
|
|
12 |
|
13 |
uploaded_file = st.file_uploader("Choose a file", "pdf")
|
14 |
if uploaded_file is not None:
|
15 |
-
|
16 |
-
|
17 |
-
output = StringIO()
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
|
33 |
|
|
|
12 |
|
13 |
uploaded_file = st.file_uploader("Choose a file", "pdf")
|
14 |
if uploaded_file is not None:
|
15 |
+
input_ = file(uploaded_file, 'rb')
|
16 |
+
output = StringIO()
|
|
|
17 |
|
18 |
+
manager = PDFResourceManager()
|
19 |
+
converter = TextConverter(manager, output, laparams=LAParams())
|
20 |
+
process_pdf(manager, converter, input_)
|
21 |
|
22 |
+
element = output.getvalue()
|
23 |
+
st.write(element)
|
24 |
+
with st.popover("Open popover"):
|
25 |
+
sound_file = BytesIO()
|
26 |
+
tts = gTTS(element, lang='en')
|
27 |
+
tts.write_to_fp(sound_file)
|
28 |
|
29 |
+
st.audio(sound_file)
|
30 |
|
31 |
|
32 |
|