Chris4K commited on
Commit
603716d
·
verified ·
1 Parent(s): e0fddbb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -13
app.py CHANGED
@@ -96,22 +96,19 @@ def handle_submission():
96
  # Display the agent's response
97
  if isinstance(response, str):
98
  # Display the text response
 
99
  st.write(response)
100
- elif isinstance(response, dict):
101
- # Check for image, audio, or other types dynamically
102
- response_keys = response.keys()
103
-
104
- if "Image" in response_keys:
105
- # Display the image response
106
- image_data = base64.b64decode(response["Image"].split(",")[1])
107
- img = Image.open(io.BytesIO(image_data))
108
- st.image(img)
109
- elif "Audio" in response_keys:
110
- # Handle audio response (replace with your audio rendering code)
111
- st.audio(response["Audio"])
112
- # Add more conditions for other types if needed
113
  else:
114
  # Handle unrecognized response type
 
115
  st.warning("Unrecognized response type.")
116
 
117
 
 
96
  # Display the agent's response
97
  if isinstance(response, str):
98
  # Display the text response
99
+ print("text")
100
  st.write(response)
101
+ elif isinstance(response, Image):
102
+ # Display the image response
103
+ print("image")
104
+ st.image(response)
105
+ elif isinstance(response, Audio):
106
+ print("audio")
107
+ # Handle audio response (replace with your audio rendering code)
108
+ st.audio(response)
 
 
 
 
 
109
  else:
110
  # Handle unrecognized response type
111
+ print("warning")
112
  st.warning("Unrecognized response type.")
113
 
114