Spaces:
Runtime error
ImagineUI
An AI-powered CSS style generator that creates and iterates on designs using natural language instructions.
Problem & Solution
Problem
Designers and developers need a tool that can:
- Translate verbal descriptions into CSS styling
- Rapidly prototype and iterate on web layouts
- Learn from real-world design patterns
Target Audience
- Frontend developers needing quick style prototypes
- UI/UX designers exploring creative variations
- Writers and content creators
- Small business owners creating marketing materials
- Cross-disciplinary teams discussing design concepts
Solution
An agentic RAG application that:
- Consumes HTML templates
- Creates style variations based on natural language input
- Iterates designs through user feedback
- Learns from CSS Zen Garden designs
Setup
This project uses Poetry for dependency management.
Prerequisites
- Python 3.11 (via brew or your system's package manager)
- Poetry:
curl -sSL https://install.python-poetry.org | python3 -
Installation
- Clone and enter the repository:
git clone https://github.com/yourusername/ImagineUI.git
cd ImagineUI
- Install dependencies:
poetry install
poetry run playwright install chromium
Tools
CSS Zen Garden Scraper
Collects designs from CSS Zen Garden into a structured dataset. Each design in designs/<design_id>/ contains:
style.css: The design's CSS filemetadata.json: Design information (author, URLs)screenshot_desktop.png: Screenshot at 1920px widthscreenshot_mobile.png: Screenshot at 480px width
Usage:
poetry run python scraper.py # Run scraper
poetry run python analyze_designs.py # Analyze designs
poetry run jupyter notebook # Test in notebook
Development
poetry add <package>: Add dependenciespoetry update: Update dependenciespoetry shell: Activate virtual environment
Project Structure
ImagineUI/
βββ designs/ # Scraped CSS Zen Garden designs
β βββ <design_id>/ # Each design's files
βββ scraper.py # CSS Zen Garden scraper
βββ test_scraper.ipynb # Scraper testing notebook
βββ pyproject.toml # Project dependencies
βββ README.md
Technical Stack
- LLM: For understanding design instructions
- Embedding Model: For design similarity search
- Vector Database: For storing design patterns
- Orchestration: For managing the design workflow
- Monitoring & Evaluation: For quality assurance
- User Interface: For interaction and feedback
AI Designer
Problem and Audience
Problem:
I want a tool that can use verbal instructions to prototype and iterate on a design for a UI or document.
Audience:
This app is for designers and non-designers who want to create UIs or documents using natural language. Examples include:
- Styling a resume using a standardized template
- Brand designers who want to iterate through ideas
- Writers who want to present content in a visually engaging way
- Creators of presentations and educational materials
- Small business owners creating marketing materials
The app will be particularly useful for cross-disciplinary web development teams discussing design concepts with stakeholders, to provide visual reference and preliminary materials for designs.
Solution
An agentic RAG application will be able to consume a template of html data, and create creative style variations based on input and feedback discussed with the user.
Tools
a: LLM b: Embedding Model c: Orchestration d: Vector Database e: Monitoring f: Evaluation g: User Interface h: Serving & Inference (optional)
Describe use of agents
Data Collection & Dataset Creation
Dataset Format
{
"id": "style_001",
"html_template": "path/to/template.html",
"css_style": "path/to/style.css",
"screenshots": {
"lg": "path/to/desktop.png",
"sm": "path/to/mobile.png"
},
"metadata": {
"description": "A minimalist business template with...",
"category": ["business", "minimalist"],
"accessibility_score": 98,
"color_scheme": ["#ffffff", "#000000", "#4285f4"]
}
}
Data Collection Process
Web Scraping
- Scrape CSS Zen Garden submissions
- Collect associated screenshots
- Extract design descriptions
Manual Curation
- Review and categorize styles
- Validate HTML/CSS combinations
- Add detailed annotations
Automated Processing
- Generate screenshots across viewports
- Extract color schemes
- Calculate accessibility scores
Quality Assurance
- Validate file integrity
- Check completeness of metadata
- Verify screenshot quality
Usage Guidelines
- Dataset is available under MIT License
- Proper attribution required for CSS Zen Garden content
- Screenshots may be used for training and testing
- Metadata can be extended with additional annotations
Build
Problem Worth Solving
Designing and styling web pages requires both creative and technical skills. Many developers and designers struggle with:
- Translating verbal descriptions into CSS styling.
- Rapidly prototyping and iterating on web layouts.
- Learning from real-world design patterns without extensive manual effort.
An agentic CSS style creator can bridge the gap by understanding style requests, generating layouts, and applying creative yet functional CSS designs.
Potential LLM Solution
- Multi-modal learning: Utilize a dataset of CSS styles (from CSS Zen Garden) and their corresponding rendered outputs (screenshots).
- RAG-enhanced retrieval: Combine existing UI pattern descriptions with CSS rules for better style understanding.
- Agentic workflow: Allow the model to iteratively improve its design based on user feedback, tweaking layouts and styles dynamically.
- Dual input approach: Users can either submit their own HTML or allow the agent to generate a basic layout.
Target Audience
- Frontend Developers who need quick style prototypes.
- UI/UX Designers looking to explore creative styles.
- No-Code/Low-Code Builders who want AI-powered styling.
- Beginner Developers learning CSS through interactive examples.
Key Metrics
- Styling Accuracy β How closely does the CSS match the user's description?
- Creativity & Uniqueness β Does it produce diverse and visually appealing results?
- Functional Usability β Are the generated styles accessible and responsive?
- Iteration Success β Does the model effectively refine the layout based on feedback?
- RAGAS Scores β To evaluate retrieval quality and grounding accuracy.
Data Sources for RAG and Fine-Tuning
- CSS Zen Garden Stylesheets β To learn various aesthetic interpretations.
- Screenshots of Zen Garden pages β For multi-modal association between styles and visuals.
- UI Pattern Dataset (with descriptions) β To enhance textual understanding of design patterns.
- Generated CSS & User Feedback Loops β To improve iteration quality.
Share
Online Communities to Share Your Project In
- r/web_design & r/frontend on Reddit β Great for frontend developers and designers.
- Twitter/X (Hashtags: #CSS, #AI, #WebDev) β To engage with the dev community.
- Dev.to & Hashnode β For technical write-ups and project showcases.
- CodePen & Frontend Mentor Discords β Where designers and developers share web experiments.
- LinkedIn Web Development Groups β For professional feedback.
Best Time to Share
- Reddit: 12 PM - 3 PM EST (high activity for tech subreddits).
- Twitter/X: 9 AM - 12 PM PST (when devs engage most).
- Dev.to / Hashnode: Post in the morning for better visibility.
- LinkedIn: 8 AM - 10 AM EST (when professionals browse feeds).
CSS Zen Garden Scraping Tools
Python-based Tools
Scrapy
- Robust framework for large-scale scraping
- Handles JavaScript rendering
- Built-in pipeline for downloading files
class ZenGardenSpider(scrapy.Spider): name = 'zengarden' start_urls = ['http://www.csszengarden.com/'] def parse(self, response): for design in response.css('.design-selection li'): yield { 'title': design.css('a::text').get(), 'css_url': design.css('a::attr(href)').get(), 'designer': design.css('.designer::text').get() }Beautiful Soup 4
- Simpler alternative for static content
- Good for parsing HTML/CSS structure
- Easy integration with requests library
Browser Automation
- Playwright
- Modern alternative to Selenium
- Better performance
- Built-in screenshot and PDF generation
- Playwright
CSS Processing Tools
- PostCSS
- Parses and analyzes CSS
- Extracts color schemes
- Identifies design patterns
- StyleStats
- Generates CSS analytics
- Measures complexity
- Reports accessibility metrics
- PostCSS
Scraping Process
Initial Setup
pip install scrapy beautifulsoup4 selenium playwright postcss-pyData Collection Steps
- Fetch main gallery page
- Extract design links and metadata
- Download CSS files
- Capture screenshots at different viewports
- Parse and analyze CSS properties
Legal Considerations
- Respect robots.txt
- Include appropriate delays between requests
- Store attribution information
- Follow CSS Zen Garden's terms of use
Data Validation
- Verify CSS file integrity
- Check image quality
- Validate HTML structure
- Ensure complete metadata