Skip to content

Commit

Permalink
light theme
Browse files Browse the repository at this point in the history
  • Loading branch information
jiatastic committed Jul 21, 2023
1 parent e0ac86e commit e146c59
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 10 deletions.
2 changes: 1 addition & 1 deletion .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[theme]
base = 'dark'
#base = 'dark'
primaryColor = 'F63366'
font = 'sans serif'
6 changes: 0 additions & 6 deletions aws/synthesize_speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,11 @@
)

def synthesize_speech(text):

Polly = Session.client("polly")

response = Polly.synthesize_speech(
Text=text,
OutputFormat="mp3",
VoiceId="Joanna")

if "AudioStream" in response:
# Note: Closing the stream is important because the service throttles on the
# number of parallel connections. Here we are using contextlib.closing to
Expand All @@ -37,12 +34,10 @@ def synthesize_speech(text):
# Could not write to file, exit gracefully
print(error)
sys.exit(-1)

else:
# The response didn't contain audio data, exit gracefully
print("Could not stream audio")
sys.exit(-1)

'''
# Play the audio using the platform's default player
if sys.platform == "win32":
Expand All @@ -51,5 +46,4 @@ def synthesize_speech(text):
# The following works on macOS and Linux. (Darwin = mac, xdg-open = linux).
opener = "open" if sys.platform == "darwin" else "xdg-open"
subprocess.call([opener, output])'''

return output
3 changes: 0 additions & 3 deletions pages/Resume Screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,17 +136,14 @@ def answer_call_back():
llm_answer = st.session_state.resume_screen.run(input)
# speech synthesis and speak out
audio_file_path = synthesize_speech(llm_answer)

st.session_state.audio_file_path = audio_file_path
# create audio widget with autoplay
audio_widget = Audio(audio_file_path, autoplay=True)

# save audio data to history
st.session_state.resume_history.append(
Message("ai", llm_answer)
)
st.session_state.token_count += cb.total_tokens

return audio_widget
except:
st.session_state.resume_history.append(Message("ai", "Sorry, I didn't get that. Please try again."))
Expand Down

0 comments on commit e146c59

Please sign in to comment.