SaileshSivan commited on
Commit
e3ea342
·
1 Parent(s): fa19010

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import streamlit as st
2
  import time
 
3
  from langchain.schema import HumanMessage, SystemMessage, AIMessage
4
  from langchain.chat_models import ChatOpenAI
5
 
@@ -155,6 +156,16 @@ if submit:
155
  st.header(":blue[You]", divider=True)
156
  st.write(message.content)
157
 
 
 
 
 
 
 
 
 
 
 
158
 
159
 
160
  else:
 
1
  import streamlit as st
2
  import time
3
+ import openai
4
  from langchain.schema import HumanMessage, SystemMessage, AIMessage
5
  from langchain.chat_models import ChatOpenAI
6
 
 
156
  st.header(":blue[You]", divider=True)
157
  st.write(message.content)
158
 
159
+ # Text-to-speech
160
+ audio_response = openai.audio.speech.create(
161
+ model="tts-1",
162
+ voice="nova",
163
+ input=response
164
+ )
165
+
166
+ # Embed audio in the webpage without saving it
167
+ st.audio(audio_response.content, format="audio/mp3")
168
+
169
 
170
 
171
  else: