Spaces:
Sleeping
Sleeping
Ari commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -185,6 +185,11 @@ def process_input():
|
|
| 185 |
|
| 186 |
# Append the assistant's insights to the history
|
| 187 |
st.session_state.history.append({"role": "assistant", "content": insights})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
# Append the result DataFrame to the history
|
| 189 |
st.session_state.history.append({"role": "assistant", "content": result})
|
| 190 |
except Exception as e:
|
|
@@ -201,6 +206,11 @@ def process_input():
|
|
| 201 |
|
| 202 |
# Append the assistant's recommendations to the history
|
| 203 |
st.session_state.history.append({"role": "assistant", "content": recommendations})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 204 |
else:
|
| 205 |
# Generate insights based on general insights (without recommendations)
|
| 206 |
dataset_summary = data.describe().to_string() # Summary for insights
|
|
@@ -210,6 +220,10 @@ def process_input():
|
|
| 210 |
|
| 211 |
# Append the assistant's general insights to the history
|
| 212 |
st.session_state.history.append({"role": "assistant", "content": insights})
|
|
|
|
|
|
|
|
|
|
|
|
|
| 213 |
|
| 214 |
except Exception as e:
|
| 215 |
logging.error(f"An error occurred: {e}")
|
|
@@ -219,6 +233,8 @@ def process_input():
|
|
| 219 |
# Reset the user_input in session state
|
| 220 |
st.session_state['user_input'] = ''
|
| 221 |
|
|
|
|
|
|
|
| 222 |
# Display the conversation history
|
| 223 |
for message in st.session_state.history:
|
| 224 |
if message['role'] == 'user':
|
|
|
|
| 185 |
|
| 186 |
# Append the assistant's insights to the history
|
| 187 |
st.session_state.history.append({"role": "assistant", "content": insights})
|
| 188 |
+
|
| 189 |
+
# Displaying insights inside an expander to avoid cutoff
|
| 190 |
+
with st.expander("Click to see detailed insights"):
|
| 191 |
+
st.markdown(insights)
|
| 192 |
+
|
| 193 |
# Append the result DataFrame to the history
|
| 194 |
st.session_state.history.append({"role": "assistant", "content": result})
|
| 195 |
except Exception as e:
|
|
|
|
| 206 |
|
| 207 |
# Append the assistant's recommendations to the history
|
| 208 |
st.session_state.history.append({"role": "assistant", "content": recommendations})
|
| 209 |
+
|
| 210 |
+
# Displaying recommendations inside an expander to avoid cutoff
|
| 211 |
+
with st.expander("Click to see detailed recommendations"):
|
| 212 |
+
st.markdown(recommendations)
|
| 213 |
+
|
| 214 |
else:
|
| 215 |
# Generate insights based on general insights (without recommendations)
|
| 216 |
dataset_summary = data.describe().to_string() # Summary for insights
|
|
|
|
| 220 |
|
| 221 |
# Append the assistant's general insights to the history
|
| 222 |
st.session_state.history.append({"role": "assistant", "content": insights})
|
| 223 |
+
|
| 224 |
+
# Displaying insights inside an expander to avoid cutoff
|
| 225 |
+
with st.expander("Click to see detailed insights"):
|
| 226 |
+
st.markdown(insights)
|
| 227 |
|
| 228 |
except Exception as e:
|
| 229 |
logging.error(f"An error occurred: {e}")
|
|
|
|
| 233 |
# Reset the user_input in session state
|
| 234 |
st.session_state['user_input'] = ''
|
| 235 |
|
| 236 |
+
|
| 237 |
+
|
| 238 |
# Display the conversation history
|
| 239 |
for message in st.session_state.history:
|
| 240 |
if message['role'] == 'user':
|