Update app.py
Browse files
app.py
CHANGED
|
@@ -207,10 +207,11 @@ if prompt := st.chat_input("How can I help you today?"):
|
|
| 207 |
st.button('Ref', on_click=click_button_onr)
|
| 208 |
|
| 209 |
if st.session_state.onr:
|
| 210 |
-
st.
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
|
|
|
| 214 |
|
| 215 |
#onr = st.toggle('Reference',key='onr')
|
| 216 |
#if choice == 'Reference':
|
|
@@ -231,15 +232,16 @@ if prompt := st.chat_input("How can I help you today?"):
|
|
| 231 |
st.button('Audio', on_click=click_button_ontts)
|
| 232 |
|
| 233 |
if st.session_state.ontts:
|
| 234 |
-
st.
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
|
|
|
| 243 |
|
| 244 |
|
| 245 |
# ontts = st.toggle('Audio')
|
|
|
|
| 207 |
st.button('Ref', on_click=click_button_onr)
|
| 208 |
|
| 209 |
if st.session_state.onr:
|
| 210 |
+
with st.sidebar:
|
| 211 |
+
st.write('ref')
|
| 212 |
+
generate_pdf()
|
| 213 |
+
st.session_state['reference'] = '/home/user/app/pdf2image/output.png'
|
| 214 |
+
st.image(st.session_state['reference'])
|
| 215 |
|
| 216 |
#onr = st.toggle('Reference',key='onr')
|
| 217 |
#if choice == 'Reference':
|
|
|
|
| 232 |
st.button('Audio', on_click=click_button_ontts)
|
| 233 |
|
| 234 |
if st.session_state.ontts:
|
| 235 |
+
with st.sidebar:
|
| 236 |
+
st.write('audio')
|
| 237 |
+
# The message and nested widget will remain on the page
|
| 238 |
+
with open('/home/user/app/audio/audio.mp3','wb') as sound_file:
|
| 239 |
+
tts = gTTS(result['result'], lang='en', tld = 'co.in')
|
| 240 |
+
tts.write_to_fp(sound_file)
|
| 241 |
+
sound = AudioSegment.from_mp3("/home/user/app/audio/audio.mp3")
|
| 242 |
+
sound.export("/home/user/app/audio/audio.wav", format="wav")
|
| 243 |
+
st.session_state['audio'] = '/home/user/app/audio/audio.wav'
|
| 244 |
+
st.audio(st.session_state['audio'])
|
| 245 |
|
| 246 |
|
| 247 |
# ontts = st.toggle('Audio')
|