Spaces:
Sleeping
Sleeping
raksa-the-wildcats commited on
Commit ·
3668ef5
1
Parent(s): f8c0dab
change ui
Browse files
app.py
CHANGED
|
@@ -92,60 +92,10 @@ def create_interface():
|
|
| 92 |
# Custom CSS for improved styling
|
| 93 |
custom_css = """
|
| 94 |
.gradio-container {
|
| 95 |
-
max-width:
|
| 96 |
margin: 0 auto !important;
|
| 97 |
}
|
| 98 |
|
| 99 |
-
.main-header {
|
| 100 |
-
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
| 101 |
-
color: white;
|
| 102 |
-
padding: 2rem;
|
| 103 |
-
border-radius: 15px;
|
| 104 |
-
margin-bottom: 2rem;
|
| 105 |
-
text-align: center;
|
| 106 |
-
box-shadow: 0 8px 32px rgba(0,0,0,0.1);
|
| 107 |
-
}
|
| 108 |
-
|
| 109 |
-
.main-header h1 {
|
| 110 |
-
margin: 0;
|
| 111 |
-
font-size: 2.5rem;
|
| 112 |
-
font-weight: 700;
|
| 113 |
-
text-shadow: 0 2px 4px rgba(0,0,0,0.3);
|
| 114 |
-
}
|
| 115 |
-
|
| 116 |
-
.main-header p {
|
| 117 |
-
margin: 1rem 0 0 0;
|
| 118 |
-
font-size: 1.1rem;
|
| 119 |
-
opacity: 0.9;
|
| 120 |
-
}
|
| 121 |
-
|
| 122 |
-
.feature-grid {
|
| 123 |
-
display: grid;
|
| 124 |
-
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 125 |
-
gap: 1rem;
|
| 126 |
-
margin: 2rem 0;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
.feature-card {
|
| 130 |
-
background: white;
|
| 131 |
-
padding: 1.5rem;
|
| 132 |
-
border-radius: 12px;
|
| 133 |
-
border: 1px solid #e1e5e9;
|
| 134 |
-
box-shadow: 0 4px 6px rgba(0,0,0,0.05);
|
| 135 |
-
transition: transform 0.2s, box-shadow 0.2s;
|
| 136 |
-
}
|
| 137 |
-
|
| 138 |
-
.feature-card:hover {
|
| 139 |
-
transform: translateY(-2px);
|
| 140 |
-
box-shadow: 0 8px 25px rgba(0,0,0,0.1);
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
.feature-card h3 {
|
| 144 |
-
color: #667eea;
|
| 145 |
-
margin: 0 0 0.5rem 0;
|
| 146 |
-
font-size: 1.2rem;
|
| 147 |
-
}
|
| 148 |
-
|
| 149 |
.chat-container {
|
| 150 |
background: white;
|
| 151 |
border-radius: 15px;
|
|
@@ -161,35 +111,6 @@ def create_interface():
|
|
| 161 |
margin-top: 1rem;
|
| 162 |
}
|
| 163 |
|
| 164 |
-
.examples-section {
|
| 165 |
-
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
|
| 166 |
-
color: white;
|
| 167 |
-
padding: 2rem;
|
| 168 |
-
border-radius: 15px;
|
| 169 |
-
margin: 2rem 0;
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
.examples-section h3 {
|
| 173 |
-
margin: 0 0 1rem 0;
|
| 174 |
-
font-size: 1.5rem;
|
| 175 |
-
}
|
| 176 |
-
|
| 177 |
-
.resources-section {
|
| 178 |
-
background: #f8f9fa;
|
| 179 |
-
border-radius: 15px;
|
| 180 |
-
padding: 2rem;
|
| 181 |
-
margin: 2rem 0;
|
| 182 |
-
border: 1px solid #e1e5e9;
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
.footer {
|
| 186 |
-
text-align: center;
|
| 187 |
-
padding: 2rem;
|
| 188 |
-
color: #6c757d;
|
| 189 |
-
border-top: 1px solid #e1e5e9;
|
| 190 |
-
margin-top: 2rem;
|
| 191 |
-
}
|
| 192 |
-
|
| 193 |
.gradio-button {
|
| 194 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 195 |
border: none !important;
|
|
@@ -228,40 +149,6 @@ def create_interface():
|
|
| 228 |
css=custom_css
|
| 229 |
) as demo:
|
| 230 |
|
| 231 |
-
# Header
|
| 232 |
-
with gr.Row():
|
| 233 |
-
with gr.Column(scale=1):
|
| 234 |
-
gr.HTML("""
|
| 235 |
-
<div class="main-header">
|
| 236 |
-
<h1>🌐 Web Accessibility Learning Assistant</h1>
|
| 237 |
-
<p>Your personal tutor for mastering web accessibility using authoritative WebAIM resources</p>
|
| 238 |
-
</div>
|
| 239 |
-
""")
|
| 240 |
-
|
| 241 |
-
# Feature highlights
|
| 242 |
-
with gr.Row():
|
| 243 |
-
with gr.Column(scale=1):
|
| 244 |
-
gr.HTML("""
|
| 245 |
-
<div class="feature-grid">
|
| 246 |
-
<div class="feature-card">
|
| 247 |
-
<h3>📋 WCAG Guidelines</h3>
|
| 248 |
-
<p>Master success criteria and implementation strategies with expert guidance</p>
|
| 249 |
-
</div>
|
| 250 |
-
<div class="feature-card">
|
| 251 |
-
<h3>🔍 Screen Reader Testing</h3>
|
| 252 |
-
<p>Learn how to test with assistive technologies like NVDA and JAWS</p>
|
| 253 |
-
</div>
|
| 254 |
-
<div class="feature-card">
|
| 255 |
-
<h3>💻 Code Examples</h3>
|
| 256 |
-
<p>Get practical HTML, CSS, and JavaScript patterns for accessibility</p>
|
| 257 |
-
</div>
|
| 258 |
-
<div class="feature-card">
|
| 259 |
-
<h3>🎯 Best Practices</h3>
|
| 260 |
-
<p>Discover real-world accessibility solutions and common pitfalls</p>
|
| 261 |
-
</div>
|
| 262 |
-
</div>
|
| 263 |
-
""")
|
| 264 |
-
|
| 265 |
# Main chat interface
|
| 266 |
with gr.Row():
|
| 267 |
with gr.Column(scale=1):
|
|
@@ -297,94 +184,6 @@ def create_interface():
|
|
| 297 |
|
| 298 |
gr.HTML('</div>')
|
| 299 |
|
| 300 |
-
# Quick start examples
|
| 301 |
-
with gr.Row():
|
| 302 |
-
with gr.Column(scale=1):
|
| 303 |
-
gr.HTML("""
|
| 304 |
-
<div class="examples-section">
|
| 305 |
-
<h3>🚀 Quick Start Examples</h3>
|
| 306 |
-
<p>Click any example below to get started with common accessibility questions:</p>
|
| 307 |
-
</div>
|
| 308 |
-
""")
|
| 309 |
-
|
| 310 |
-
gr.Examples(
|
| 311 |
-
examples=[
|
| 312 |
-
"What are the WCAG 2.1 AA requirements for color contrast?",
|
| 313 |
-
"How do I make forms accessible to screen readers?",
|
| 314 |
-
"What's the difference between aria-label and aria-labelledby?",
|
| 315 |
-
"How can I test my website with a screen reader?",
|
| 316 |
-
"What are the most common accessibility mistakes students make?",
|
| 317 |
-
"How do I write effective alt text for complex images?",
|
| 318 |
-
"What ARIA roles should I use for a navigation menu?",
|
| 319 |
-
"How do I make data tables accessible?",
|
| 320 |
-
"What are the keyboard navigation requirements?",
|
| 321 |
-
"How do I ensure my site works without JavaScript?"
|
| 322 |
-
],
|
| 323 |
-
inputs=msg,
|
| 324 |
-
examples_per_page=5,
|
| 325 |
-
label="Example Questions"
|
| 326 |
-
)
|
| 327 |
-
|
| 328 |
-
# Additional resources
|
| 329 |
-
with gr.Row():
|
| 330 |
-
with gr.Column(scale=1):
|
| 331 |
-
gr.HTML("""
|
| 332 |
-
<div class="resources-section">
|
| 333 |
-
<h3>📚 Additional Learning Resources</h3>
|
| 334 |
-
</div>
|
| 335 |
-
""")
|
| 336 |
-
|
| 337 |
-
with gr.Accordion("🛠️ Recommended Tools", open=False):
|
| 338 |
-
gr.Markdown("""
|
| 339 |
-
### Essential Accessibility Testing Tools:
|
| 340 |
-
|
| 341 |
-
**🔍 Automated Testing:**
|
| 342 |
-
- **WAVE**: Web accessibility evaluation tool (wave.webaim.org)
|
| 343 |
-
- **axe DevTools**: Browser extension for accessibility testing
|
| 344 |
-
- **Lighthouse**: Built-in accessibility audit in Chrome DevTools
|
| 345 |
-
- **HTML_CodeSniffer**: Bookmarklet for quick accessibility checks
|
| 346 |
-
|
| 347 |
-
**🎧 Screen Readers:**
|
| 348 |
-
- **NVDA**: Free screen reader for Windows
|
| 349 |
-
- **JAWS**: Professional screen reader (paid)
|
| 350 |
-
- **VoiceOver**: Built-in screen reader for macOS
|
| 351 |
-
- **TalkBack**: Android screen reader
|
| 352 |
-
|
| 353 |
-
**🎨 Color & Contrast:**
|
| 354 |
-
- **WebAIM Contrast Checker**: Verify color contrast ratios
|
| 355 |
-
- **Color Oracle**: Simulate color blindness
|
| 356 |
-
- **Stark**: Design tool with accessibility features
|
| 357 |
-
""")
|
| 358 |
-
|
| 359 |
-
with gr.Accordion("📋 Key Standards & Guidelines", open=False):
|
| 360 |
-
gr.Markdown("""
|
| 361 |
-
### Web Accessibility Standards:
|
| 362 |
-
|
| 363 |
-
**🌐 WCAG 2.1:**
|
| 364 |
-
- **Level A**: Basic accessibility requirements
|
| 365 |
-
- **Level AA**: Standard compliance (most common target)
|
| 366 |
-
- **Level AAA**: Highest level of accessibility
|
| 367 |
-
|
| 368 |
-
**🇺🇸 US Standards:**
|
| 369 |
-
- **Section 508**: Federal accessibility requirements
|
| 370 |
-
- **ADA**: Americans with Disabilities Act considerations
|
| 371 |
-
- **CVAA**: 21st Century Communications and Video Accessibility Act
|
| 372 |
-
|
| 373 |
-
**🌍 International:**
|
| 374 |
-
- **EN 301 549**: European accessibility standard
|
| 375 |
-
- **ISO 9241-171**: International ergonomics standard
|
| 376 |
-
""")
|
| 377 |
-
|
| 378 |
-
# Footer
|
| 379 |
-
with gr.Row():
|
| 380 |
-
with gr.Column(scale=1):
|
| 381 |
-
gr.HTML("""
|
| 382 |
-
<div class="footer">
|
| 383 |
-
<p><strong>This chatbot uses authoritative WebAIM resources and is powered by DeepSeek-R1.</strong></p>
|
| 384 |
-
<p>For the most up-to-date information, always refer to the original WebAIM documentation at <a href="https://webaim.org" target="_blank">webaim.org</a></p>
|
| 385 |
-
</div>
|
| 386 |
-
""")
|
| 387 |
-
|
| 388 |
# Handle message submission
|
| 389 |
def respond(message, history):
|
| 390 |
if not message.strip():
|
|
|
|
| 92 |
# Custom CSS for improved styling
|
| 93 |
custom_css = """
|
| 94 |
.gradio-container {
|
| 95 |
+
max-width: 800px !important;
|
| 96 |
margin: 0 auto !important;
|
| 97 |
}
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
.chat-container {
|
| 100 |
background: white;
|
| 101 |
border-radius: 15px;
|
|
|
|
| 111 |
margin-top: 1rem;
|
| 112 |
}
|
| 113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
.gradio-button {
|
| 115 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
| 116 |
border: none !important;
|
|
|
|
| 149 |
css=custom_css
|
| 150 |
) as demo:
|
| 151 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
# Main chat interface
|
| 153 |
with gr.Row():
|
| 154 |
with gr.Column(scale=1):
|
|
|
|
| 184 |
|
| 185 |
gr.HTML('</div>')
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
# Handle message submission
|
| 188 |
def respond(message, history):
|
| 189 |
if not message.strip():
|