Dramatically improve UX with clear feedback and better interactions
Browse filesMajor UX enhancements:
- Crystal clear processing indicator showing exact user question
- Animated loading spinner with descriptive status messages
- Helpful onboarding instructions for new users
- 15 diverse sample questions with better variety
User experience improvements:
- Better chat input placeholder with specific guidance
- Tooltips and help text throughout interface
- Clear visual feedback on all interactive elements
- Removed dataset info section for cleaner sidebar
Button and interaction upgrades:
- Smaller, space-efficient sidebar buttons (0.75rem font)
- Left-aligned, clean styling without cluttering icons
- Smooth hover transitions and clear active states
- More sample questions covering seasonal patterns, correlations, guidelines
Chart styling improvements:
- Professional matplotlib styling with modern color palette
- Clean white backgrounds and subtle grids
- Better typography and spacing in visualizations
- Higher quality output with improved readability
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>
|
@@ -224,18 +224,21 @@ st.markdown("""
|
|
| 224 |
background-color: #0b5ed7;
|
| 225 |
}
|
| 226 |
|
| 227 |
-
/* Sidebar button styling */
|
| 228 |
[data-testid="stSidebar"] .stButton > button {
|
| 229 |
background-color: #f8fafc;
|
| 230 |
color: #475569;
|
| 231 |
border: 1px solid #e2e8f0;
|
| 232 |
-
padding: 0.
|
| 233 |
-
font-size: 0.
|
| 234 |
font-weight: normal;
|
| 235 |
text-align: left;
|
| 236 |
white-space: normal;
|
| 237 |
height: auto;
|
| 238 |
line-height: 1.2;
|
|
|
|
|
|
|
|
|
|
| 239 |
}
|
| 240 |
|
| 241 |
[data-testid="stSidebar"] .stButton > button:hover {
|
|
@@ -244,6 +247,11 @@ st.markdown("""
|
|
| 244 |
color: #0c4a6e;
|
| 245 |
}
|
| 246 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 247 |
/* Code container styling */
|
| 248 |
.code-container {
|
| 249 |
margin: 1rem 0;
|
|
@@ -569,29 +577,35 @@ with st.sidebar:
|
|
| 569 |
"Show annual PM2.5 average",
|
| 570 |
"Compare winter vs summer pollution",
|
| 571 |
"List all cities by pollution level",
|
| 572 |
-
"Plot monthly average PM2.5 for 2023"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 573 |
]
|
| 574 |
|
| 575 |
-
# Quick query buttons in sidebar
|
| 576 |
selected_prompt = None
|
| 577 |
-
for i, question in enumerate(questions[:6]): # Show only first 6
|
| 578 |
-
# Don't truncate - show full text
|
| 579 |
-
if st.button(question, key=f"sidebar_prompt_{i}", use_container_width=True):
|
| 580 |
-
selected_prompt = question
|
| 581 |
-
|
| 582 |
-
st.markdown("---")
|
| 583 |
|
| 584 |
-
#
|
| 585 |
-
st.markdown("### Dataset Info")
|
| 586 |
st.markdown("""
|
| 587 |
-
<div style='background
|
| 588 |
-
<
|
| 589 |
-
<p style='margin: 0.25rem 0; font-size: 0.875rem;'><strong>Time Range:</strong> Jan 2023 - Dec 2023</p>
|
| 590 |
-
<p style='margin: 0.25rem 0; font-size: 0.875rem;'><strong>Locations:</strong> 15 cities in Gujarat</p>
|
| 591 |
-
<p style='margin: 0.25rem 0; font-size: 0.875rem;'><strong>Records:</strong> 13,140 measurements</p>
|
| 592 |
</div>
|
| 593 |
""", unsafe_allow_html=True)
|
| 594 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 595 |
# Current Model Info
|
| 596 |
st.markdown("### Current Model")
|
| 597 |
st.markdown(f"**{model_name}**")
|
|
@@ -624,6 +638,20 @@ with st.sidebar:
|
|
| 624 |
except AttributeError:
|
| 625 |
st.experimental_rerun()
|
| 626 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
# Workflow steps section (like in mockup)
|
| 628 |
st.markdown("""
|
| 629 |
<div style='background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 1rem 2rem; display: flex; gap: 1rem; margin-bottom: 1rem;'>
|
|
@@ -707,15 +735,27 @@ def show_custom_response(response):
|
|
| 707 |
return {"is_image": False}
|
| 708 |
|
| 709 |
def show_processing_indicator(model_name, question):
|
| 710 |
-
"""Show processing indicator with
|
| 711 |
st.markdown(f"""
|
| 712 |
<div style='display: flex; justify-content: flex-start; margin: 1rem 0;'>
|
| 713 |
<div class='processing-indicator'>
|
| 714 |
-
<div style='font-size: 0.875rem; color: #6b7280; margin-bottom:
|
| 715 |
-
<
|
| 716 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 717 |
</div>
|
| 718 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 719 |
""", unsafe_allow_html=True)
|
| 720 |
|
| 721 |
# Main chat container with mockup styling
|
|
@@ -784,8 +824,8 @@ with chat_container:
|
|
| 784 |
st.session_state.get("current_question", "Processing...")
|
| 785 |
)
|
| 786 |
|
| 787 |
-
# Chat input
|
| 788 |
-
prompt = st.chat_input("Ask
|
| 789 |
|
| 790 |
# Handle selected prompt from quick prompts
|
| 791 |
if selected_prompt:
|
|
|
|
| 224 |
background-color: #0b5ed7;
|
| 225 |
}
|
| 226 |
|
| 227 |
+
/* Sidebar button styling - smaller, left-aligned */
|
| 228 |
[data-testid="stSidebar"] .stButton > button {
|
| 229 |
background-color: #f8fafc;
|
| 230 |
color: #475569;
|
| 231 |
border: 1px solid #e2e8f0;
|
| 232 |
+
padding: 0.375rem 0.75rem;
|
| 233 |
+
font-size: 0.75rem;
|
| 234 |
font-weight: normal;
|
| 235 |
text-align: left;
|
| 236 |
white-space: normal;
|
| 237 |
height: auto;
|
| 238 |
line-height: 1.2;
|
| 239 |
+
transition: all 0.2s ease;
|
| 240 |
+
cursor: pointer;
|
| 241 |
+
margin-bottom: 0.25rem;
|
| 242 |
}
|
| 243 |
|
| 244 |
[data-testid="stSidebar"] .stButton > button:hover {
|
|
|
|
| 247 |
color: #0c4a6e;
|
| 248 |
}
|
| 249 |
|
| 250 |
+
[data-testid="stSidebar"] .stButton > button:active {
|
| 251 |
+
transform: translateY(0);
|
| 252 |
+
box-shadow: none;
|
| 253 |
+
}
|
| 254 |
+
|
| 255 |
/* Code container styling */
|
| 256 |
.code-container {
|
| 257 |
margin: 1rem 0;
|
|
|
|
| 577 |
"Show annual PM2.5 average",
|
| 578 |
"Compare winter vs summer pollution",
|
| 579 |
"List all cities by pollution level",
|
| 580 |
+
"Plot monthly average PM2.5 for 2023",
|
| 581 |
+
"Show seasonal pollution patterns",
|
| 582 |
+
"Which pollutant has highest concentration?",
|
| 583 |
+
"Create correlation plot between pollutants",
|
| 584 |
+
"What are peak pollution hours?",
|
| 585 |
+
"Compare weekday vs weekend levels",
|
| 586 |
+
"Show PM10 vs PM2.5 comparison",
|
| 587 |
+
"Plot yearly trend analysis",
|
| 588 |
+
"Which areas exceed WHO guidelines?",
|
| 589 |
+
"Show pollution distribution by city"
|
| 590 |
]
|
| 591 |
|
| 592 |
+
# Quick query buttons in sidebar with helpful descriptions
|
| 593 |
selected_prompt = None
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 594 |
|
| 595 |
+
# Add description for quick queries
|
|
|
|
| 596 |
st.markdown("""
|
| 597 |
+
<div style='background: #fef9e7; border: 1px solid #fbbf24; border-radius: 6px; padding: 0.5rem; margin-bottom: 0.75rem; font-size: 0.75rem; color: #92400e;'>
|
| 598 |
+
💡 <strong>Click any question below</strong> to start analyzing the air quality data instantly
|
|
|
|
|
|
|
|
|
|
| 599 |
</div>
|
| 600 |
""", unsafe_allow_html=True)
|
| 601 |
|
| 602 |
+
for i, question in enumerate(questions[:12]): # Show more questions
|
| 603 |
+
# Simple left-aligned buttons without icons for cleaner look
|
| 604 |
+
if st.button(question, key=f"sidebar_prompt_{i}", use_container_width=True, help=f"Click to analyze: {question}"):
|
| 605 |
+
selected_prompt = question
|
| 606 |
+
|
| 607 |
+
st.markdown("---")
|
| 608 |
+
|
| 609 |
# Current Model Info
|
| 610 |
st.markdown("### Current Model")
|
| 611 |
st.markdown(f"**{model_name}**")
|
|
|
|
| 638 |
except AttributeError:
|
| 639 |
st.experimental_rerun()
|
| 640 |
|
| 641 |
+
# Helpful instructions section
|
| 642 |
+
if not st.session_state.responses:
|
| 643 |
+
st.markdown("""
|
| 644 |
+
<div style='background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 8px; padding: 1.5rem; margin-bottom: 1rem; border-left: 4px solid #3b82f6;'>
|
| 645 |
+
<h4 style='margin: 0 0 0.5rem 0; color: #1e293b; font-size: 1rem;'>💡 How to Use VayuChat</h4>
|
| 646 |
+
<p style='margin: 0.25rem 0; font-size: 0.875rem; color: #475569;'>
|
| 647 |
+
• <strong>Click any quick query</strong> from the sidebar to start analyzing air quality data<br>
|
| 648 |
+
• <strong>Type your own question</strong> in the chat box below<br>
|
| 649 |
+
• <strong>Ask about trends, comparisons, or specific data points</strong><br>
|
| 650 |
+
• <strong>Request visualizations</strong> with phrases like "plot" or "show chart"
|
| 651 |
+
</p>
|
| 652 |
+
</div>
|
| 653 |
+
""", unsafe_allow_html=True)
|
| 654 |
+
|
| 655 |
# Workflow steps section (like in mockup)
|
| 656 |
st.markdown("""
|
| 657 |
<div style='background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 1rem 2rem; display: flex; gap: 1rem; margin-bottom: 1rem;'>
|
|
|
|
| 735 |
return {"is_image": False}
|
| 736 |
|
| 737 |
def show_processing_indicator(model_name, question):
|
| 738 |
+
"""Show processing indicator with clear question and status"""
|
| 739 |
st.markdown(f"""
|
| 740 |
<div style='display: flex; justify-content: flex-start; margin: 1rem 0;'>
|
| 741 |
<div class='processing-indicator'>
|
| 742 |
+
<div style='font-size: 0.875rem; color: #6b7280; margin-bottom: 8px;'>🤖 VayuChat • Processing with {model_name}</div>
|
| 743 |
+
<div style='background: rgba(255,255,255,0.9); padding: 0.75rem; border-radius: 8px; margin-bottom: 8px; border-left: 3px solid #3b82f6;'>
|
| 744 |
+
<strong style='color: #1e293b;'>Your Question:</strong><br>
|
| 745 |
+
<span style='color: #374151; font-size: 0.95rem;'>{question}</span>
|
| 746 |
+
</div>
|
| 747 |
+
<div style='display: flex; align-items: center; gap: 8px;'>
|
| 748 |
+
<div style='width: 16px; height: 16px; border: 2px solid #3b82f6; border-top: 2px solid transparent; border-radius: 50%; animation: spin 1s linear infinite;'></div>
|
| 749 |
+
<span style='color: #374151; font-style: italic;'>Analyzing data and generating response...</span>
|
| 750 |
+
</div>
|
| 751 |
</div>
|
| 752 |
</div>
|
| 753 |
+
<style>
|
| 754 |
+
@keyframes spin {{
|
| 755 |
+
0% {{ transform: rotate(0deg); }}
|
| 756 |
+
100% {{ transform: rotate(360deg); }}
|
| 757 |
+
}}
|
| 758 |
+
</style>
|
| 759 |
""", unsafe_allow_html=True)
|
| 760 |
|
| 761 |
# Main chat container with mockup styling
|
|
|
|
| 824 |
st.session_state.get("current_question", "Processing...")
|
| 825 |
)
|
| 826 |
|
| 827 |
+
# Chat input with better guidance
|
| 828 |
+
prompt = st.chat_input("💬 Ask about air quality trends, compare cities, or request visualizations...", key="main_chat")
|
| 829 |
|
| 830 |
# Handle selected prompt from quick prompts
|
| 831 |
if selected_prompt:
|
|
@@ -241,7 +241,29 @@ def ask_question(model_name, question):
|
|
| 241 |
df_check = df_check.head(5)
|
| 242 |
|
| 243 |
new_line = "\n"
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
template = f"""```python
|
| 247 |
import pandas as pd
|
|
@@ -271,6 +293,10 @@ df["Timestamp"] = pd.to_datetime(df["Timestamp"])
|
|
| 271 |
4. Use descriptive variable names and add comments
|
| 272 |
5. Handle potential errors gracefully
|
| 273 |
6. For plots, use unique filenames to avoid conflicts
|
|
|
|
|
|
|
|
|
|
|
|
|
| 274 |
"""
|
| 275 |
|
| 276 |
query = f"""{system_prompt}
|
|
|
|
| 241 |
df_check = df_check.head(5)
|
| 242 |
|
| 243 |
new_line = "\n"
|
| 244 |
+
# Professional matplotlib styling
|
| 245 |
+
parameters = {
|
| 246 |
+
"font.size": 11,
|
| 247 |
+
"figure.dpi": 150,
|
| 248 |
+
"figure.facecolor": "white",
|
| 249 |
+
"axes.facecolor": "white",
|
| 250 |
+
"axes.edgecolor": "#e2e8f0",
|
| 251 |
+
"axes.linewidth": 1.2,
|
| 252 |
+
"axes.labelcolor": "#374151",
|
| 253 |
+
"axes.spines.top": False,
|
| 254 |
+
"axes.spines.right": False,
|
| 255 |
+
"axes.spines.left": True,
|
| 256 |
+
"axes.spines.bottom": True,
|
| 257 |
+
"axes.grid": True,
|
| 258 |
+
"grid.color": "#f1f5f9",
|
| 259 |
+
"grid.linewidth": 0.8,
|
| 260 |
+
"grid.alpha": 0.7,
|
| 261 |
+
"xtick.color": "#6b7280",
|
| 262 |
+
"ytick.color": "#6b7280",
|
| 263 |
+
"text.color": "#374151",
|
| 264 |
+
"figure.figsize": [12, 6],
|
| 265 |
+
"axes.prop_cycle": "cycler('color', ['#3b82f6', '#ef4444', '#10b981', '#f59e0b', '#8b5cf6', '#06b6d4'])"
|
| 266 |
+
}
|
| 267 |
|
| 268 |
template = f"""```python
|
| 269 |
import pandas as pd
|
|
|
|
| 293 |
4. Use descriptive variable names and add comments
|
| 294 |
5. Handle potential errors gracefully
|
| 295 |
6. For plots, use unique filenames to avoid conflicts
|
| 296 |
+
7. Make plots professional with proper titles, labels, and styling
|
| 297 |
+
8. Use plt.tight_layout() before saving plots
|
| 298 |
+
9. For line plots, use linewidth=2.5 and markersize=8 for better visibility
|
| 299 |
+
10. Add proper axis labels with units (e.g., 'PM2.5 (µg/m³)')
|
| 300 |
"""
|
| 301 |
|
| 302 |
query = f"""{system_prompt}
|