Add Replicate provider, model selection, and Patch Library features
Major additions:
1. Replicate AI Provider
- Support for multiple models (SDXL, LaMa, Realistic Vision)
- Auto-model selection based on prompt keywords
- Best for human features: realistic-vision (~$0.020/image)
- Best for removal: lama (~$0.002/image)
- Best general purpose: sdxl-inpaint (~$0.025/image)
- Smart keyword detection for automatic model selection
2. Enhanced Stability AI Provider
- Optimized parameters for better quality
- Support for multiple engines (SDXL, SD 1.5, SD 2.1)
- Increased steps and CFG scale for improved results
3. Model Selection System
- Per-edit model override capability
- Global default model configuration
- Provider-specific model options
- Auto-selection based on prompt analysis
4. Patch Library Feature
- Save AI-generated patches for reuse
- Save manually selected regions
- Import external images as patches
- Organize with categories and tags
- Browse and filter patch library
- Apply saved patches to new images
- Thumbnail generation for quick preview
- Cost savings by reusing good results
5. Comprehensive Documentation
- MODEL_SELECTION_GUIDE.md: Detailed guide for choosing models
* Best models for hands, faces, bodies
* Quality comparison table
* Cost optimization strategies
* Troubleshooting common issues
- QUICK_START.md: How-to guide for new features
* Model selection examples
* Patch library workflow
* API reference
* Pro tips and cost comparisons
6. Configuration Updates
- Added Replicate API key support
- Model selection settings
- Per-edit override toggle
- Updated .env.example with all options
Benefits:
- Better quality for human features (hands, faces)
- 90% cost reduction using lama for removals
- Reusable patch library saves money and ensures consistency
- Auto-model selection optimizes quality and cost
- Flexibility to choose provider and model per edit
All backend changes are fully functional and ready for use.
Frontend UI for patch library pending.
This commit is contained in:
@@ -68,6 +68,45 @@ class UploadResponse(BaseModel):
|
||||
current_url: str
|
||||
|
||||
|
||||
# Patch Library schemas
|
||||
class PatchCreate(BaseModel):
|
||||
name: str
|
||||
description: Optional[str] = None
|
||||
source_type: str # "ai_generated", "manual_selection", "imported"
|
||||
source_project_id: Optional[int] = None
|
||||
source_edit_id: Optional[int] = None
|
||||
category: Optional[str] = None
|
||||
tags: Optional[str] = None
|
||||
bbox: Optional[Dict[str, int]] = None
|
||||
|
||||
|
||||
class PatchResponse(BaseModel):
|
||||
id: int
|
||||
name: str
|
||||
description: Optional[str]
|
||||
created_at: datetime
|
||||
source_type: str
|
||||
source_project_id: Optional[int]
|
||||
source_edit_id: Optional[int]
|
||||
width: int
|
||||
height: int
|
||||
tags: Optional[str]
|
||||
category: Optional[str]
|
||||
is_public: bool
|
||||
file_path: str
|
||||
thumbnail_path: Optional[str]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
|
||||
class PatchApply(BaseModel):
|
||||
project_id: int
|
||||
patch_id: int
|
||||
bbox: Dict[str, int]
|
||||
feather_px: int = 5
|
||||
|
||||
|
||||
# Generic responses
|
||||
class StatusResponse(BaseModel):
|
||||
status: str
|
||||
|
||||
Reference in New Issue
Block a user