vishwask commited on
Commit
e7152f9
·
1 Parent(s): 1c3f38b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -15
app.py CHANGED
@@ -243,21 +243,19 @@ if prompt := st.chat_input("How can I help you today?"):
243
 
244
  # st.button('Audio', on_click=click_button_ontts)
245
 
246
- if button('Reference and TTS', key = 'button1'):
247
- if button('Reference', key = 'button2'):
248
- with st.sidebar:
249
- generate_pdf()
250
- st.session_state['reference'] = '/home/user/app/pdf2image/output.png'
251
- st.image(st.session_state['reference'])
252
- if button('TTS', key = 'button3'):
253
- with st.sidebar:
254
- with open('/home/user/app/audio/audio.mp3','wb') as sound_file:
255
- tts = gTTS(result['result'], lang='en', tld = 'co.in')
256
- tts.write_to_fp(sound_file)
257
- sound = AudioSegment.from_mp3("/home/user/app/audio/audio.mp3")
258
- sound.export("/home/user/app/audio/audio.wav", format="wav")
259
- st.session_state['audio'] = '/home/user/app/audio/audio.wav'
260
- st.audio(st.session_state['audio'])
261
 
262
 
263
 
 
243
 
244
  # st.button('Audio', on_click=click_button_ontts)
245
 
246
+
247
+ if button('Reference', key = 'button2'):
248
+ generate_pdf()
249
+ st.session_state['reference'] = '/home/user/app/pdf2image/output.png'
250
+ st.image(st.session_state['reference'])
251
+ if button('TTS', key = 'button3'):
252
+ with open('/home/user/app/audio/audio.mp3','wb') as sound_file:
253
+ tts = gTTS(result['result'], lang='en', tld = 'co.in')
254
+ tts.write_to_fp(sound_file)
255
+ sound = AudioSegment.from_mp3("/home/user/app/audio/audio.mp3")
256
+ sound.export("/home/user/app/audio/audio.wav", format="wav")
257
+ st.session_state['audio'] = '/home/user/app/audio/audio.wav'
258
+ st.audio(st.session_state['audio'])
 
 
259
 
260
 
261