Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -44,8 +44,6 @@ if "messages" not in st.session_state:
|
|
44 |
if "agent_chain" not in st.session_state:
|
45 |
st.session_state.agent_chain = create_agent_chain()
|
46 |
|
47 |
-
if "polly_client" not in st.session_state:
|
48 |
-
st.session_state.polly_client = PollyClient()
|
49 |
|
50 |
for message in st.session_state.messages:
|
51 |
with st.chat_message(message["role"]):
|
@@ -64,11 +62,4 @@ if prompt:
|
|
64 |
response = st.session_state.agent_chain.run(system_prompt + prompt, callbacks = [callback])
|
65 |
st.markdown(response)
|
66 |
|
67 |
-
# 音声ファイルを生成
|
68 |
-
file_name = "response.mp3"
|
69 |
-
st.session_state.polly_client.text_to_speech(response, file_name)
|
70 |
-
|
71 |
-
audio_file_path = file_name
|
72 |
-
st.audio(audio_file_path)
|
73 |
-
|
74 |
st.session_state.messages.append({"role": "assistant", "content": response})
|
|
|
44 |
if "agent_chain" not in st.session_state:
|
45 |
st.session_state.agent_chain = create_agent_chain()
|
46 |
|
|
|
|
|
47 |
|
48 |
for message in st.session_state.messages:
|
49 |
with st.chat_message(message["role"]):
|
|
|
62 |
response = st.session_state.agent_chain.run(system_prompt + prompt, callbacks = [callback])
|
63 |
st.markdown(response)
|
64 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
st.session_state.messages.append({"role": "assistant", "content": response})
|