Spaces:
Sleeping
Sleeping
Ari commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -183,12 +183,8 @@ def process_input():
|
|
| 183 |
'result': result_str
|
| 184 |
})
|
| 185 |
|
| 186 |
-
#
|
| 187 |
-
st.
|
| 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})
|
|
@@ -204,12 +200,8 @@ def process_input():
|
|
| 204 |
'result': dataset_summary
|
| 205 |
})
|
| 206 |
|
| 207 |
-
#
|
| 208 |
-
st.
|
| 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)
|
|
@@ -218,12 +210,8 @@ def process_input():
|
|
| 218 |
'result': dataset_summary
|
| 219 |
})
|
| 220 |
|
| 221 |
-
#
|
| 222 |
-
st.
|
| 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}")
|
|
@@ -232,19 +220,3 @@ def process_input():
|
|
| 232 |
|
| 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':
|
| 241 |
-
st.markdown(f"**User:** {message['content']}")
|
| 242 |
-
elif message['role'] == 'assistant':
|
| 243 |
-
if isinstance(message['content'], pd.DataFrame):
|
| 244 |
-
st.markdown("**Assistant:** Query Results:")
|
| 245 |
-
st.dataframe(message['content'])
|
| 246 |
-
else:
|
| 247 |
-
st.markdown(f"**Assistant:** {message['content']}")
|
| 248 |
-
|
| 249 |
-
# Place the input field at the bottom with the callback
|
| 250 |
-
st.text_input("Enter your message:", key='user_input', on_change=process_input)
|
|
|
|
| 183 |
'result': result_str
|
| 184 |
})
|
| 185 |
|
| 186 |
+
# Use st.text_area to avoid text cutoff for long outputs
|
| 187 |
+
st.text_area("Insights", value=insights, height=300)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 188 |
|
| 189 |
# Append the result DataFrame to the history
|
| 190 |
st.session_state.history.append({"role": "assistant", "content": result})
|
|
|
|
| 200 |
'result': dataset_summary
|
| 201 |
})
|
| 202 |
|
| 203 |
+
# Use st.text_area to avoid text cutoff for long outputs
|
| 204 |
+
st.text_area("Recommendations", value=recommendations, height=300)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 205 |
|
| 206 |
else:
|
| 207 |
# Generate insights based on general insights (without recommendations)
|
|
|
|
| 210 |
'result': dataset_summary
|
| 211 |
})
|
| 212 |
|
| 213 |
+
# Use st.text_area to avoid text cutoff for long outputs
|
| 214 |
+
st.text_area("Insights", value=insights, height=300)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 215 |
|
| 216 |
except Exception as e:
|
| 217 |
logging.error(f"An error occurred: {e}")
|
|
|
|
| 220 |
|
| 221 |
# Reset the user_input in session state
|
| 222 |
st.session_state['user_input'] = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|