Solshine commited on
Commit
dffb983
1 Parent(s): ef156fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
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
- def to_txt(uploaded_file):
16
- input_ = file(uploaded_file, 'rb')
17
- output = StringIO()
18
 
19
- manager = PDFResourceManager()
20
- converter = TextConverter(manager, output, laparams=LAParams())
21
- process_pdf(manager, converter, input_)
22
 
23
- element = output.getvalue()
24
- st.write(element)
25
- with st.popover("Open popover"):
26
- sound_file = BytesIO()
27
- tts = gTTS(element, lang='en')
28
- tts.write_to_fp(sound_file)
29
 
30
- st.audio(sound_file)
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