Update app.py
Browse files
app.py
CHANGED
@@ -120,16 +120,20 @@ def handle_submission():
|
|
120 |
# ...
|
121 |
|
122 |
# Display the agent's response
|
123 |
-
if
|
124 |
# Display the image response
|
125 |
-
|
126 |
-
img = Image.open(io.BytesIO(image_data))
|
127 |
-
st.image(img)
|
128 |
elif "audio" in response:
|
129 |
# Handle audio response (replace with your audio rendering code)
|
130 |
audio_data = base64.b64decode(response.split(",")[1])
|
131 |
audio = AudioSegment.from_file(io.BytesIO(audio_data))
|
132 |
st.audio(audio)
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
elif "text" in response:
|
134 |
# Display the text response
|
135 |
st.write(response)
|
|
|
120 |
# ...
|
121 |
|
122 |
# Display the agent's response
|
123 |
+
if isinstance(response, Image.Image):
|
124 |
# Display the image response
|
125 |
+
st.image(response)
|
|
|
|
|
126 |
elif "audio" in response:
|
127 |
# Handle audio response (replace with your audio rendering code)
|
128 |
audio_data = base64.b64decode(response.split(",")[1])
|
129 |
audio = AudioSegment.from_file(io.BytesIO(audio_data))
|
130 |
st.audio(audio)
|
131 |
+
elif isinstance(response, AudioSegment):
|
132 |
+
# Handle audio response (replace with your audio rendering code)
|
133 |
+
st.audio(response)
|
134 |
+
elif isinstance(response, str):
|
135 |
+
# Display the text response
|
136 |
+
st.write(response)
|
137 |
elif "text" in response:
|
138 |
# Display the text response
|
139 |
st.write(response)
|