image-gen / openspec /project.md
feddernico's picture
added prompts and resources to the MCP server
325cb09
# Project Context
## Purpose
A production-grade image generation web application built with Gradio and Stable Diffusion. Provides a text-to-image interface using Hugging Face's diffusers library.
## Tech Stack
- **Language**: Python 3.10+
- **ML Framework**: PyTorch (>=2.1.0)
- **Image Generation**: Diffusers (>=0.21.0), Transformers (>=4.39.0)
- **UI**: Gradio (>=6.5.1)
- **Model Hub**: Hugging Face Hub (>=0.25.0)
- **Acceleration**: Accelerate
### Development Tools
- **Linting/Formatting**: Ruff, Black
- **Testing**: pytest
## Project Conventions
### Code Style
- Format Python code with **Black** (line length: 88)
- Lint with **Ruff** (follows PEP 8)
- Use type hints for function signatures
- Import order: stdlib → third-party → local
### Architecture Patterns
- Single-file app structure (`app.py` for core logic)
- Gradio Interface for web UI
- Lazy model loading (load on first request)
- CPU by default (can toggle to GPU)
### Testing Strategy
- Unit tests for business logic in `tests/` directory
- Integration tests for Gradio interface
- Run tests with: `pytest`
### Git Workflow
- **Main branch**: Production-ready code
- **Feature branches**: `feature/<name>` for new features
- Commit messages: Clear, concise descriptions
- No merge commits preferred (rebase workflow)
## Domain Context
- Text-to-image generation using Stable Diffusion
- Hugging Face Spaces deployment compatible
- Model: `OFA-Sys/small-stable-diffusion-v0`
## Important Constraints
- CPU inference by default (can be switched to GPU)
- Model loaded at startup (can be lazy-loaded for HF Spaces)
- 20 inference steps default
## External Dependencies
- Hugging Face Hub (model downloads)
- Diffusers library (Stable Diffusion pipeline)