vishwask commited on
Commit
69ec8ca
·
1 Parent(s): f3b606e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -193,20 +193,21 @@ if prompt := st.chat_input("How can I help you today?"):
193
 
194
 
195
  with st.sidebar:
196
- choice = st.radio("References and TTS",["Reference & TTS" ], index=None,)
197
- if choice == 'Reference & TTS':
 
198
  generate_pdf()
199
  st.session_state['reference'] = '/home/user/app/pdf2image/output.png'
200
  st.image(st.session_state['reference'])
201
-
202
- st.session_state.reference = True
203
  with open('/home/user/app/audio/audio.mp3','wb') as sound_file:
204
  tts = gTTS(result['result'], lang='en', tld = 'co.in')
205
  tts.write_to_fp(sound_file)
206
  sound = AudioSegment.from_mp3("/home/user/app/audio/audio.mp3")
207
  sound.export("/home/user/app/audio/audio.wav", format="wav")
208
  st.session_state['audio'] = '/home/user/app/audio/audio.wav'
209
- #st.audio(st.session_state['audio'])
210
 
211
  st.session_state.messages.append({"role": "assistant", "content": full_response})
212
 
 
193
 
194
 
195
  with st.sidebar:
196
+ choice = st.radio("References and TTS",["Reference" , 'TTS'], index=None)
197
+
198
+ if choice == 'Reference':
199
  generate_pdf()
200
  st.session_state['reference'] = '/home/user/app/pdf2image/output.png'
201
  st.image(st.session_state['reference'])
202
+
203
+ if choice == 'TTS':
204
  with open('/home/user/app/audio/audio.mp3','wb') as sound_file:
205
  tts = gTTS(result['result'], lang='en', tld = 'co.in')
206
  tts.write_to_fp(sound_file)
207
  sound = AudioSegment.from_mp3("/home/user/app/audio/audio.mp3")
208
  sound.export("/home/user/app/audio/audio.wav", format="wav")
209
  st.session_state['audio'] = '/home/user/app/audio/audio.wav'
210
+ st.audio(st.session_state['audio'])
211
 
212
  st.session_state.messages.append({"role": "assistant", "content": full_response})
213