Spaces:
Sleeping
Sleeping
N.Achyuth Reddy
commited on
Commit
·
950ee57
1
Parent(s):
e5c49ff
Update app.py
Browse files
app.py
CHANGED
@@ -56,12 +56,16 @@ def predict(message, system_prompt='Your name is OpenGPT. You are developed by A
|
|
56 |
)
|
57 |
st.write("Done")
|
58 |
return response
|
|
|
59 |
|
60 |
# Function to convert text to speech
|
61 |
def text_to_speech(text, language='en', filename='output.mp3'):
|
62 |
tts = gTTS(text=text, lang=language, slow=False)
|
63 |
tts.save(filename)
|
64 |
os.system(f'start {filename}')
|
|
|
|
|
|
|
65 |
|
66 |
# Streamlit UI
|
67 |
st.title(TITLE)
|
@@ -115,7 +119,3 @@ if prompt := textinput:
|
|
115 |
st.markdown(response)
|
116 |
# Add assistant response to chat history
|
117 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
118 |
-
|
119 |
-
# Convert response to speech
|
120 |
-
response=response
|
121 |
-
text_to_speech(response)
|
|
|
56 |
)
|
57 |
st.write("Done")
|
58 |
return response
|
59 |
+
|
60 |
|
61 |
# Function to convert text to speech
|
62 |
def text_to_speech(text, language='en', filename='output.mp3'):
|
63 |
tts = gTTS(text=text, lang=language, slow=False)
|
64 |
tts.save(filename)
|
65 |
os.system(f'start {filename}')
|
66 |
+
# Convert response to speech
|
67 |
+
response=response
|
68 |
+
text_to_speech(response)
|
69 |
|
70 |
# Streamlit UI
|
71 |
st.title(TITLE)
|
|
|
119 |
st.markdown(response)
|
120 |
# Add assistant response to chat history
|
121 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
|
|
|
|
|