Update app.py
Browse files
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 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
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 |
|