space-ac-design / README.md
AI Software Factory
fix: Add GitHub token authentication for Gist creation
be2dec1
|
Raw History Blame Contribute Delete
8.86 kB

A newer version of the Gradio SDK is available: 6.32.0

Upgrade
metadata
title: Space AC Design Variations
emoji: 🎨
colorFrom: purple
colorTo: pink
sdk: gradio
sdk_version: 5.49.0
app_file: app.py
pinned: false
license: mit

🎨 Space AC: Design Variations

AI-powered design system generation for Flutter apps

Part of the AI Software Factory - a complete system that generates Flutter applications from Notion wireframes to GitHub PRs.

πŸš€ Features

This space contains specialized AI agents for design system generation:

⚑ Simple Generator (NEW!) βœ… LIVE

  • Zero-configuration Flutter code generation
  • Prompt β†’ DeepSeek β†’ Flutter Code β†’ DartPad (auto-loaded!)
  • Automatic GitHub Gist creation for instant DartPad embedding
  • No themes, no presets - just describe what you want
  • Code automatically loaded in DartPad - just click "Run"!
  • Collapsible code viewer for clean UI

Example prompts:

  • "Create a modern login screen with email and password"
  • "Generate a fitness app home page with statistics cards"
  • "Build a todo list with checkboxes and delete buttons"

AC1: Moodboard Analyzer πŸ–ΌοΈ βœ… LIVE

  • Analyzes reference app screenshots
  • Extracts color palettes with visual previews
  • Identifies UI patterns and components
  • Detects typography trends
  • Generates actionable design insights

AC2: Design Variation Generator 🎨 βœ… LIVE

  • Generates 4 complete design theme variations
  • Defines design tokens (colors, typography, spacing)
  • Creates comprehensive design system specifications
  • Interactive theme cards with visual preview

AC3: Flutter Screen Generator πŸ’» βœ… LIVE

  • Generates runnable Flutter/Dart code for DartPad
  • AI-powered planning with Llama 3.1 70B + Jinja2 templates
  • Creates 3 screens per theme with realistic components
  • Supports 10 app types (fitness, banking, rider, ecommerce, social, etc.)
  • 400-500 lines of production-ready Dart code per screen

Coming Soon:

  • AC4: Theme Comparator (pros/cons analysis and recommendations)

🎯 Use Cases

  • Design System Creation: Generate complete design systems from inspiration
  • Theme Development: Create multiple design variations quickly
  • Competitor Analysis: Analyze design patterns from reference apps
  • Design Documentation: Auto-generate design tokens and guidelines

πŸ”§ API Endpoints

POST /api/moodboard-analyzer

Analyze a moodboard to extract design insights.

Request:

{
  "reference_images": [
    {
      "url": "https://example.com/screenshot.png",
      "description": "Instagram home feed - dark mode"
    }
  ],
  "mood_keywords": ["energetic", "gaming", "modern"]
}

Response:

{
  "success": true,
  "output": {
    "analysis": {
      "color_palettes": [...],
      "typography_trends": [...],
      "ui_patterns": [...],
      "insights": "..."
    }
  }
}

POST /api/design-variation-generator

Generate 4 design theme variations from moodboard analysis.

Request:

{
  "moodboard_analysis": {
    "color_palettes": [...],
    "typography_trends": [...],
    "ui_patterns": [...]
  },
  "wireframe": "E-commerce app with product grid and checkout",
  "app_context": {
    "type": "mobile_app"
  }
}

Response:

{
  "success": true,
  "output": {
    "themes": [
      {
        "name": "Bold Energy",
        "style": "bold",
        "palette": {...},
        "typography": {...},
        "spacing": {...},
        "component_style": {...},
        "animations": {...}
      }
    ]
  }
}

POST /api/flutter-screen-generator

Generate Flutter/Dart code from design themes (AC3).

Request:

{
  "theme": {
    "name": "Bold Energy",
    "palette": {...},
    "typography": {...},
    "spacing": {...}
  },
  "app_type": "fitness",
  "screens": ["home", "profile", "settings"]
}

Response:

{
  "success": true,
  "output": {
    "screens": [
      {
        "name": "home",
        "code": "import 'package:flutter/material.dart';\n\n// Full Dart code...",
        "lines": 487,
        "components": ["StatsCard", "HeroBanner"],
        "status": "generated"
      }
    ],
    "theme_name": "Bold Energy",
    "app_type": "fitness",
    "total_lines": 1420
  }
}

Note: Requires HF_TOKEN environment variable for Llama 3.1 access.

πŸ”‘ Environment Variables

To enable all features, you need to configure the following environment variables:

HuggingFace Token (Required for AC1, AC2, AC3)

All three agents use HuggingFace Inference API to access Llama models.

  1. Get your token from HuggingFace Settings
  2. Create a .env file in the project root:
cp .env.example .env
  1. Add your token to .env:
HF_TOKEN=your_huggingface_token_here

On HuggingFace Spaces:

  • Go to Space Settings β†’ Variables
  • Add HF_TOKEN as a secret

Note: Without the token, agents will use fallback/mock data.

GitHub Token (Required for Simple Generator Auto-load DartPad)

The Simple Generator feature automatically loads generated Flutter code into DartPad by creating GitHub Gists.

Required for:

  • ⚑ Simple Generator β†’ Auto-load code in DartPad

Setup Instructions:

  1. Create a GitHub Personal Access Token (classic):

    • Go to GitHub Settings β†’ Tokens
    • Click "Generate new token (classic)"
    • Give it a name like "HF Space Gist Creator"
    • Select scopes: gist (only this scope is needed)
    • Click "Generate token"
    • Copy the token (you won't see it again!)
  2. Add to .env file:

GITHUB_TOKEN=ghp_yourGitHubTokenHere

On HuggingFace Spaces:

  • Go to Space Settings β†’ Variables
  • Add GITHUB_TOKEN as a secret (not a public variable!)

Note: Without this token, the Simple Generator will still work, but users will need to manually copy-paste code into DartPad instead of automatic loading.

πŸ’» Local Development

# Clone the repository
git clone https://huggingface.co/spaces/OneWeekApp/space-ac-design
cd space-ac-design

# Install dependencies
pip install -r requirements.txt

# Configure environment variables
cp .env.example .env
# Edit .env and add your HuggingFace token

# Run locally
python app.py

The Gradio interface will be available at http://localhost:7860

🧠 AI Models Used

  • DeepSeek Coder - Direct Flutter code generation (Simple Generator)
  • Llama 3.2 Vision (11B) - Image analysis (AC1)
  • Llama 3.1 (70B) - Text generation and synthesis (AC2)
  • Llama 3.1 (70B) - Flutter code planning (AC3)
  • Jinja2 Templates - Dart code generation (AC3)

πŸ“Š Example Usage

Python

import requests

response = requests.post(
    "https://OneWeekApp-space-ac-design.hf.space/api/moodboard-analyzer",
    json={
        "reference_images": [
            {"description": "Instagram dark mode", "url": ""}
        ],
        "mood_keywords": ["energetic", "gaming"]
    }
)

result = response.json()
palettes = result["output"]["analysis"]["color_palettes"]
print(palettes)

cURL

curl -X POST https://OneWeekApp-space-ac-design.hf.space/api/moodboard-analyzer \
  -H "Content-Type: application/json" \
  -d '{
    "reference_images": [{"description": "Uber driver app", "url": ""}],
    "mood_keywords": ["professional", "modern"]
  }'

πŸ—οΈ Architecture

This space is part of the AI Software Factory system:

Notion Wireframe
    ↓
Space AC (Design) ← You are here
    ↓
Space A (Architecture)
    ↓
Space B (Code Generation)
    ↓
Spaces C-N (Testing, DB, Platform, etc.)
    ↓
GitHub PR with complete Flutter app

πŸ“ Input Examples

Gaming/Energetic Theme

Reference Images:
- PUBG Mobile home screen - dark mode, neon accents
- Fortnite battle pass - vibrant colors, bold typography
- Uber driver stats - clean cards, green highlights

Mood: gaming, energetic, bold

Professional Theme

Reference Images:
- LinkedIn feed - white cards, blue accents
- Banking app - clean layout, trust signals
- Notion workspace - minimal, organized

Mood: professional, trustworthy, modern

πŸ”— Related Spaces

Part of the AI Software Factory ecosystem:

  • space-a-architecture - System architecture design
  • space-b-codegen - Flutter code generation
  • space-c-testing-white - Unit & widget tests
  • space-d-testing-black - E2E tests
  • space-e-database - Database & backend

πŸ“„ License

MIT License

🀝 Contributing

This space is part of a research project. Contributions welcome!

πŸ“§ Contact


Built with ❀️ using Gradio, FastAPI, and HuggingFace Inference API