Spaces:
Sleeping
Sleeping
| # π¨ Gradio UI/UX Enhancement Guide | |
| This guide covers the various options available to improve the UI/UX of your Docs Navigator Gradio interface. | |
| ## π Quick Start | |
| ### Option 1: Use the Enhanced Default | |
| ```bash | |
| python app_gradio.py | |
| ``` | |
| The main `app_gradio.py` has been upgraded with professional styling, better error handling, and modern design. | |
| ### Option 2: Try Different Styles | |
| ```bash | |
| python launch_ui.py enhanced # Modern professional (default) | |
| python launch_ui.py minimal # Clean, simple | |
| python launch_ui.py corporate # Business/enterprise | |
| python launch_ui.py dark # Dark mode | |
| python launch_ui.py glassmorphism # Modern glass effect | |
| ``` | |
| ### Option 3: Explore All Options | |
| ```bash | |
| python gradio_ui_showcase.py modern | |
| python gradio_ui_showcase.py dark | |
| python gradio_ui_showcase.py minimal | |
| python gradio_ui_showcase.py corporate | |
| python gradio_ui_showcase.py glassmorphism | |
| ``` | |
| ## π Available UI Styles | |
| ### 1. **Enhanced Professional** (Default) | |
| - **File**: `app_gradio.py` | |
| - **Features**: Modern design, custom CSS, professional theme, avatars, examples | |
| - **Best for**: General use, professional presentations | |
| ### 2. **Modern Animated** | |
| - **File**: `gradio_ui_showcase.py modern` | |
| - **Features**: Gradient backgrounds, animations, glassmorphism effects | |
| - **Best for**: Impressive demos, modern aesthetics | |
| ### 3. **Dark Mode Professional** | |
| - **File**: `gradio_ui_showcase.py dark` or `launch_ui.py dark` | |
| - **Features**: Dark theme, reduced eye strain, professional appearance | |
| - **Best for**: Long usage sessions, developer-focused environments | |
| ### 4. **Minimal Clean** | |
| - **File**: `launch_ui.py minimal` | |
| - **Features**: Distraction-free, simple, fast loading | |
| - **Best for**: Focus on content, minimal resource usage | |
| ### 5. **Corporate Enterprise** | |
| - **File**: `launch_ui.py corporate` | |
| - **Features**: Business-appropriate styling, professional colors | |
| - **Best for**: Enterprise environments, formal presentations | |
| ### 6. **Glassmorphism Modern** | |
| - **File**: `gradio_ui_showcase.py glassmorphism` | |
| - **Features**: Glass effects, modern transparency, cutting-edge design | |
| - **Best for**: Showcasing modern design trends | |
| ## π οΈ Customization Options | |
| ### Theme Customization | |
| You can easily customize themes in `ui_config.py`: | |
| ```python | |
| from ui_config import create_theme, create_custom_css | |
| # Create custom theme | |
| my_theme = create_theme("professional", "purple_theme") | |
| # Create custom CSS | |
| my_css = create_custom_css( | |
| components=["container", "modern_input", "animated_buttons"], | |
| color_scheme="green_theme" | |
| ) | |
| ``` | |
| ### Available Color Schemes | |
| - `blue_gradient`: Blue to purple gradient (default) | |
| - `corporate_blue`: Professional blue tones | |
| - `purple_theme`: Purple-focused palette | |
| - `green_theme`: Green nature-inspired colors | |
| ### CSS Components | |
| You can mix and match these CSS components: | |
| - `container`: Basic container styling | |
| - `glass_effect`: Glassmorphism background effects | |
| - `modern_input`: Enhanced input field styling | |
| - `animated_buttons`: Button hover animations | |
| - `chat_bubbles`: Enhanced chat message styling | |
| ## π― Advanced Customization | |
| ### 1. Custom Avatars | |
| Replace the avatar URLs in any interface: | |
| ```python | |
| avatar_images=( | |
| "path/to/user-avatar.png", # User avatar | |
| "path/to/bot-avatar.png" # Bot avatar | |
| ) | |
| ``` | |
| ### 2. Custom Fonts | |
| Add Google Fonts or system fonts: | |
| ```python | |
| theme = gr.themes.Soft( | |
| font=[ | |
| gr.themes.GoogleFont("Your-Font-Name"), | |
| "fallback-font", | |
| "sans-serif" | |
| ] | |
| ) | |
| ``` | |
| ### 3. Custom CSS | |
| Add your own CSS for complete control: | |
| ```python | |
| custom_css = """ | |
| .your-custom-class { | |
| /* Your styles here */ | |
| } | |
| """ | |
| demo = gr.ChatInterface( | |
| css=custom_css, | |
| # ... other options | |
| ) | |
| ``` | |
| ### 4. Layout Modifications | |
| Customize the chat interface components: | |
| ```python | |
| gr.ChatInterface( | |
| chatbot=gr.Chatbot( | |
| height=600, # Adjust height | |
| show_label=False, # Hide labels | |
| bubble_full_width=False, # Bubble styling | |
| show_share_button=False # Hide share button | |
| ), | |
| textbox=gr.Textbox( | |
| placeholder="Custom placeholder...", | |
| container=False, # Remove container | |
| scale=7 # Adjust width ratio | |
| ), | |
| submit_btn=gr.Button("Send π", variant="primary"), | |
| examples=["Custom", "Examples", "Here"] | |
| ) | |
| ``` | |
| ## π¨ Design Best Practices | |
| ### 1. **Color Psychology** | |
| - **Blue**: Trust, professionalism, reliability | |
| - **Purple**: Creativity, innovation, luxury | |
| - **Green**: Growth, harmony, freshness | |
| - **Dark themes**: Reduced eye strain, modern feel | |
| ### 2. **Typography** | |
| - Use system fonts for fast loading: `system-ui`, `sans-serif` | |
| - Google Fonts for custom branding: `Inter`, `Poppins`, `Roboto` | |
| - Maintain good contrast ratios for accessibility | |
| ### 3. **Layout** | |
| - Keep max-width around 1000-1200px for readability | |
| - Use consistent spacing and border-radius | |
| - Ensure responsive design for mobile devices | |
| ### 4. **Animations** | |
| - Use subtle transitions (0.2-0.3s) | |
| - Avoid excessive animations that distract | |
| - Add hover effects for interactive feedback | |
| ## π§ Performance Considerations | |
| ### Fast Loading Options | |
| - **Minimal theme**: Fastest loading, least CSS | |
| - **System fonts**: No external font loading | |
| - **Reduced animations**: Better performance on slower devices | |
| ### Rich Experience Options | |
| - **Custom CSS**: More personalization, slightly slower | |
| - **Google Fonts**: Better typography, requires internet | |
| - **Complex animations**: Better UX, more CPU usage | |
| ## π± Mobile Responsiveness | |
| All themes include mobile-responsive design with: | |
| - Adjusted padding and margins for small screens | |
| - Scalable text and components | |
| - Touch-friendly button sizes | |
| - Optimized chat bubble sizing | |
| ## π Deployment Tips | |
| ### For Production | |
| 1. Use the **Corporate** or **Enhanced** themes for professional environments | |
| 2. Test on different screen sizes and devices | |
| 3. Consider loading times for your users | |
| 4. Enable error handling and user feedback | |
| ### For Demos | |
| 1. Use **Modern** or **Glassmorphism** for visual impact | |
| 2. Include engaging examples and clear descriptions | |
| 3. Consider public sharing options with `share=True` | |
| ### For Development | |
| 1. Use **Dark** theme for reduced eye strain | |
| 2. Enable detailed error messages | |
| 3. Use **Minimal** theme for faster iteration | |
| ## π Quick Reference | |
| | Style | Command | Best For | | |
| |-------|---------|----------| | |
| | Enhanced | `python app_gradio.py` | General use | | |
| | Modern | `python gradio_ui_showcase.py modern` | Demos | | |
| | Dark | `python launch_ui.py dark` | Development | | |
| | Minimal | `python launch_ui.py minimal` | Focus | | |
| | Corporate | `python launch_ui.py corporate` | Business | | |
| | Glass | `python gradio_ui_showcase.py glassmorphism` | Showcase | | |
| --- | |
| π¨ **Pro Tip**: Mix and match elements from different themes to create your perfect UI! Use `ui_config.py` as a starting point for custom configurations. |