paintplus: vendor the app source and rename from EditmaskwithAI

Bring the full EditmaskwithAI application into the repo under paintplus/
(429 files) so the service is self-contained — the installer copies the
vendored source to ~/docker/paintplus/src instead of cloning at runtime.

Rename to PaintPlus (service + branding; app logic untouched):
- services/editmaskwithai.sh -> services/paintplus.sh (register_service
  paintplus, install_paintplus, ~/docker/paintplus, Caddy paintplus:8000,
  Authelia option preserved)
- container names -> paintplus across docker-compose*.yml; dev network
  -> paintplus-network
- browser <title> -> "PaintPlus - AI Image Editor"; README heading ->
  PaintPlus with upstream provenance note
- README utilities table: editmaskwithai -> paintplus

Backend/frontend code (help strings referencing the old container name,
the ai_photo_edit.db filename) is intentionally left as-is to avoid
touching application logic.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nb2vJ8W7bHKx1JXVvpCraH
This commit is contained in:
Claude
2026-06-26 05:48:43 +00:00
parent b4e8ba2a79
commit 084922afaa
431 changed files with 87396 additions and 77 deletions
+261
View File
@@ -0,0 +1,261 @@
# AI Provider Cost & Quality Comparison
## Provider Options for Inpainting/Image Editing
### 1. OpenAI DALL-E 2 ❌ (Not Recommended)
**Current implementation uses this when `AI_PROVIDER=openai`**
**Pricing:**
- $0.020 per image (1024x1024)
- $0.018 per image (512x512)
**Quality:** ⭐⭐ (2/5)
- Old model (2022)
- Significantly lower quality than DALL-E 3
- Cannot match ChatGPT web interface
- Often produces artifacts
**Pros:**
- Simple API
- Fast responses
**Cons:**
- Poor quality by modern standards
- Limited to 1024x1024 max
- No access to DALL-E 3 inpainting
**Verdict:** ❌ Don't use unless you need the cheapest option and quality doesn't matter
---
### 2. Stability AI (Stable Diffusion XL) ✅ (Good Choice)
**Direct API to Stability AI**
**Pricing:**
- Credits-based system
- ~$0.010 per image (512x512)
- ~$0.040 per image (1024x1024)
- Must buy credit packs ($10 minimum = 1000 credits)
**Quality:** ⭐⭐⭐⭐ (4/5)
- Excellent inpainting quality
- Good at following prompts
- Natural-looking results
- Well-suited for photo editing
**Pros:**
- Built specifically for inpainting
- Good quality-to-cost ratio
- Reliable API
- Fast generation (15-30 seconds)
**Cons:**
- Requires credit purchase upfront
- Limited to SDXL models
- Less flexible than Replicate
**Verdict:** ✅ Best balance of quality and cost for direct API
---
### 3. Replicate ⭐ (Most Flexible)
**API marketplace with multiple models**
**Pricing:** Pay-per-second of GPU time
- SDXL Inpainting: ~$0.0023/sec (~$0.01-0.03 per image)
- Kandinsky 2.2: ~$0.0023/sec (~$0.01-0.02 per image)
- LaMa (removal): ~$0.0005/sec (~$0.002 per image)
- Varies by model and parameters
**Quality:** ⭐⭐⭐⭐⭐ (5/5 - depends on model choice)
- Access to multiple models
- Can choose best model for each use case
- Community models available
- Often better than Stability direct
**Pros:**
- Multiple models to choose from
- Pay only for what you use (no minimums)
- Can use free models
- New models added regularly
- Fine-tuned models available
**Cons:**
- More complex to implement
- Pricing varies by model
- Need to understand different models
**Best Models on Replicate:**
- **SDXL Inpainting**: General purpose, excellent quality
- **LaMa**: Best for object removal
- **Kandinsky 2.2**: Good alternative to SDXL
- **ControlNet Inpainting**: More control over results
**Verdict:** ⭐ Most flexible, best value if you implement multiple models
---
### 4. Local Models (Self-Hosted) 💰 (Best Quality, No Per-Use Cost)
**Pricing:**
- $0 per image after setup
- Requires GPU (RTX 3060 12GB minimum, RTX 4090 ideal)
- Cloud GPU: $0.30-$1.00/hour (RunPod, Vast.ai)
**Quality:** ⭐⭐⭐⭐⭐ (5/5)
- Best possible quality
- Full control over model selection
- Can use latest open-source models
- No API limitations
**Setup Costs:**
- GPU hardware: $300-$2000
- OR Cloud GPU rental: $0.30-$1.00/hour
**Pros:**
- Unlimited usage once set up
- Best quality available
- Complete privacy
- No API rate limits
- Can fine-tune models
**Cons:**
- Requires GPU or cloud rental
- More complex setup
- Slower than cloud APIs (if CPU only)
**Verdict:** 💰 Best long-term if you have GPU or high volume
---
## Stability AI vs Replicate: What's the Difference?
### Stability AI (stability.ai)
**What it is:**
- The company that created Stable Diffusion
- Direct API to their hosted models
- Official source
**Business Model:**
- Buy credits upfront
- Credits expire after 3 months
- Official support
- Guaranteed uptime SLA
**Models Available:**
- Stable Diffusion XL
- Stable Diffusion 1.5
- Their official models only
---
### Replicate (replicate.com)
**What it is:**
- Marketplace/platform for running ML models
- Hosts models from many sources
- Pay-per-use GPU time
**Business Model:**
- Pay only for GPU seconds used
- No upfront purchase
- No credits that expire
- $0.01 minimum charge per prediction
**Models Available:**
- Stability AI's models (SDXL, SD 1.5)
- Community models
- Fine-tuned variants
- Specialized models (LaMa, ControlNet, etc.)
- 100+ image generation models
**Think of it like:**
- **Stability AI** = Buying directly from Apple
- **Replicate** = App Store with many developers
---
## Cost Comparison Examples
### Scenario: 100 edits per month
| Provider | Cost per Image | Monthly Cost | Quality |
|----------|---------------|--------------|---------|
| DALL-E 2 | $0.020 | $2.00 | ⭐⭐ Poor |
| Stability AI | $0.040 | $4.00 | ⭐⭐⭐⭐ Good |
| Replicate (SDXL) | $0.025 | $2.50 | ⭐⭐⭐⭐⭐ Excellent |
| Replicate (LaMa) | $0.002 | $0.20 | ⭐⭐⭐⭐ Good for removal |
| Local GPU | $0.00 | $0.00* | ⭐⭐⭐⭐⭐ Best |
*Requires $500+ GPU or $0.30-1.00/hr cloud GPU
### Scenario: 1000 edits per month (Heavy use)
| Provider | Monthly Cost | Notes |
|----------|--------------|-------|
| DALL-E 2 | $20.00 | Not worth it |
| Stability AI | $40.00 | Need $10-40 credit refills |
| Replicate (SDXL) | $25.00 | Pay as you go |
| Local GPU | $0.00 | GPU pays for itself after ~50K images |
| Cloud GPU (RunPod) | $20-60 | Depends on uptime needed |
---
## Quality Rankings for Inpainting
**Best to Worst:**
1. **Local SDXL Inpainting** ⭐⭐⭐⭐⭐ (self-hosted)
2. **Replicate SDXL Inpainting** ⭐⭐⭐⭐⭐
3. **Stability AI SDXL** ⭐⭐⭐⭐
4. **Replicate LaMa** ⭐⭐⭐⭐ (for removal only)
5. **DALL-E 2** ⭐⭐ (outdated)
---
## Recommendation by Use Case
### Best for Testing/Development: Mock Provider
- Cost: $0
- Quality: N/A (returns original)
- Use when: Building/testing UI
### Best for Low Volume (< 100/month): Replicate
- Cost: ~$2.50/month
- Quality: ⭐⭐⭐⭐⭐
- No minimum purchase
- Multiple model options
### Best for Medium Volume (100-1000/month): Replicate or Stability AI
- Replicate: ~$25/month, more flexibility
- Stability AI: ~$40/month, simpler API
### Best for High Volume (1000+/month): Local GPU or Cloud GPU
- Unlimited usage
- Best quality
- Full control
### Best Overall Value: Replicate
- No minimum purchase
- Pay only for what you use
- Best model selection
- Easy to try multiple models
---
## My Recommendation
Start with **Replicate** because:
1. ✅ No upfront cost (vs Stability's $10 minimum)
2. ✅ Better quality than DALL-E 2
3. ✅ Can try multiple models to find what works
4. ✅ Cheapest per-image for low-medium volume
5. ✅ Can switch to Stability AI later if needed
**Next Steps:**
- I can add Replicate support (30 min of work)
- Test with SDXL Inpainting first
- Try LaMa for object removal
- Fall back to Stability if needed
Would you like me to add Replicate support?
+369
View File
@@ -0,0 +1,369 @@
# Model Selection Guide for Body Parts and Editing Tasks
## Quick Reference: Best Models by Use Case
### Human Features (Faces, Hands, Bodies)
**Best Choice: `realistic-vision` (Replicate)**
```env
AI_PROVIDER=replicate
REPLICATE_API_KEY=your-key
REPLICATE_MODEL=realistic-vision
```
**Why:** Trained specifically on human anatomy and realistic photos. Handles difficult features like:
- ✅ Hands (notoriously hard for AI)
- ✅ Faces and facial features
- ✅ Skin textures and tones
- ✅ Body proportions
- ✅ Portraits
**Examples:**
- "Fix the hand position"
- "Remove red eye"
- "Smooth skin blemishes"
- "Adjust facial expression"
- "Fix fingers"
**Cost:** ~$0.020/image
**Quality:** ⭐⭐⭐⭐⭐
---
### Object Removal
**Best Choice: `lama` (Replicate)**
```env
AI_PROVIDER=replicate
REPLICATE_MODEL=lama
```
**Why:** Specifically designed for inpainting and object removal. Excellent at:
- ✅ Removing objects cleanly
- ✅ Filling in backgrounds naturally
- ✅ Maintaining surrounding context
- ✅ Fast and cheap
**Examples:**
- "Remove the person"
- "Delete the watermark"
- "Erase the object"
- "Clean up the background"
**Cost:** ~$0.002/image (cheapest!)
**Quality:** ⭐⭐⭐⭐
---
### General Purpose Editing
**Best Choice: `sdxl-inpaint` (Replicate or Stability AI)**
```env
# Option 1: Replicate
AI_PROVIDER=replicate
REPLICATE_MODEL=sdxl-inpaint
# Option 2: Stability AI Direct
AI_PROVIDER=stability
STABILITY_MODEL=sdxl
```
**Why:** SDXL (Stable Diffusion XL) is the best all-around model for:
- ✅ Landscapes and scenery
- ✅ Objects and textures
- ✅ Creative edits
- ✅ Style changes
- ✅ Adding elements
**Examples:**
- "Change sky to sunset"
- "Add flowers"
- "Make it autumn"
- "Replace with grass"
**Cost:**
- Replicate: ~$0.025/image
- Stability AI: ~$0.040/image
**Quality:** ⭐⭐⭐⭐⭐
---
## Detailed Comparison by Body Part
### Hands ✋
**Challenge:** Hands are the hardest thing for AI to generate correctly. Common issues:
- Wrong number of fingers
- Unnatural finger positions
- Distorted proportions
- Weird joints
**Best Models (in order):**
1. **Realistic Vision** (Replicate) - ⭐⭐⭐⭐⭐
- Best overall for hands
- Understands hand anatomy
- Cost: ~$0.020/image
2. **SDXL Inpainting** (Replicate/Stability) - ⭐⭐⭐
- Decent but less consistent
- Cost: ~$0.025-0.040/image
3. **DALL-E 2** (OpenAI) - ⭐⭐
- Often struggles with hands
- Not recommended
**Tips for Better Hand Edits:**
- Use detailed prompts: "realistic human hand with five fingers"
- Add negative prompts if provider supports: "deformed, extra fingers, missing fingers"
- Use Mode B (full image context) for better results
- Consider editing in multiple passes if needed
---
### Faces 😊
**Challenge:** Faces need to look natural and maintain proper proportions
**Best Models:**
1. **Realistic Vision** (Replicate) - ⭐⭐⭐⭐⭐
- Excellent for facial features
- Natural skin textures
- Good expression handling
2. **SDXL Inpainting** - ⭐⭐⭐⭐
- Good for general facial edits
- Better for style than realism
**Use Cases:**
- Remove blemishes
- Fix red eye
- Adjust expressions
- Change hair
- Smooth wrinkles
---
### Full Body / Torso 🧍
**Best Model:** Realistic Vision
**Why:** Maintains body proportions and realistic anatomy
**Examples:**
- "Fix the clothing wrinkles"
- "Change shirt color to blue"
- "Remove the stain"
---
### Hearts ♥️ (Decorative Elements)
**Best Model:** SDXL Inpainting
**Why:** Great for creative and decorative elements
**Examples:**
- "Add heart shape"
- "Draw a heart pattern"
- "Replace with hearts"
---
## Auto-Selection Feature
The system automatically selects the best model based on your prompt:
### Keywords that trigger `realistic-vision`:
- hand, hands, finger, fingers
- face, facial, portrait, eyes, nose, mouth
- body, person, human, skin, people
- realistic, photo, photograph
### Keywords that trigger `lama` (removal):
- remove, delete, erase, cleanup
- disappear, hide, clear
### Default: `sdxl-inpaint`
- Everything else uses SDXL for best general quality
**Example Auto-Selection:**
```python
# User prompt: "Fix the hand" → auto-selects realistic-vision
# User prompt: "Remove the person" → auto-selects lama
# User prompt: "Change to sunset" → auto-selects sdxl-inpaint
```
---
## Manual Model Override
### Via Environment Variable
Set default model in `.env`:
```env
REPLICATE_MODEL=realistic-vision
```
### Via API Request
Override per-edit in the API:
```json
{
"prompt": "Fix the hand",
"ai_provider": "replicate",
"ai_model": "realistic-vision",
"mode": "A",
...
}
```
### Via Frontend (Future Feature)
Model selector dropdown in the UI.
---
## Cost Optimization Strategies
### For Low-Volume Users (< 100 edits/month)
**Recommendation:** Use Replicate with auto-selection
**Why:**
- No minimum purchase
- Pay only for what you use
- Auto-selects cheapest appropriate model
**Estimated Cost:** $1-3/month
---
### For Medium-Volume Users (100-1000 edits/month)
**Recommendation:** Replicate or Stability AI
**Strategy:**
- Use `lama` for removals ($0.002/image)
- Use `realistic-vision` for humans ($0.020/image)
- Use `sdxl-inpaint` for general ($0.025/image)
**Estimated Cost:** $10-30/month
---
### For High-Volume Users (1000+ edits/month)
**Recommendation:** Consider local GPU or cloud GPU
**Why:**
- No per-image cost
- Best quality control
- Privacy
**Setup:**
- Local: RTX 3060+ GPU ($300-2000 one-time)
- Cloud: RunPod/Vast.ai ($0.30-1.00/hour)
---
## Quality Comparison Table
| Use Case | DALL-E 2 | Stability SDXL | Replicate SDXL | Replicate Realistic | Replicate LaMa |
|----------|----------|----------------|----------------|---------------------|----------------|
| Hands | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Faces | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Bodies | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| Objects | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | N/A |
| Landscapes | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | N/A |
| Removal | ⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| Creative | ⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐ | ⭐ |
---
## Advanced Tips
### For Difficult Hands
1. **Use Mode B** - Provides full image context
2. **Be specific** - "realistic five-fingered hand in natural pose"
3. **Multiple passes** - Fix gross errors first, then refine
4. **Reference images** - Mode B helps AI understand the pose
### For Facial Features
1. **High feather value** - 10-15px for smooth blending
2. **Small selections** - Target specific features
3. **Natural lighting** - Mention lighting in prompt
### For Body Parts
1. **Maintain proportions** - Use Mode B for body context
2. **Clothing context** - Include clothing description in prompt
3. **Skin tone consistency** - Mention skin tone if needed
---
## Troubleshooting Common Issues
### "Hands have too many fingers"
- **Solution:** Switch to `realistic-vision` model
- **Prompt:** "realistic human hand with exactly five fingers"
- **Try:** Multiple generations, pick best result
### "Face looks unnatural"
- **Solution:** Use `realistic-vision` model
- **Increase:** Feather value to 15-20px
- **Try:** Mode B for better context
### "Removal leaves artifacts"
- **Solution:** Use `lama` model (designed for removal)
- **Alternative:** SDXL with prompt "clean background"
### "Colors don't match"
- **Increase:** Feather value to 20-30px
- **Try:** Mode B for better color context
- **Prompt:** Include color description
---
## Quick Start Examples
### Example 1: Fix a Hand
```json
{
"prompt": "realistic human hand with five fingers, natural pose",
"ai_provider": "replicate",
"ai_model": "realistic-vision",
"mode": "B",
"feather_px": 10
}
```
### Example 2: Remove an Object
```json
{
"prompt": "remove the object, clean background",
"ai_provider": "replicate",
"ai_model": "lama",
"mode": "A",
"feather_px": 5
}
```
### Example 3: Change Sky
```json
{
"prompt": "sunset sky with orange and pink clouds",
"ai_provider": "replicate",
"ai_model": "sdxl-inpaint",
"mode": "A",
"feather_px": 15
}
```
---
## Summary
**For Body Parts:** Use `realistic-vision` (Replicate)
**For Removal:** Use `lama` (Replicate)
**For Everything Else:** Use `sdxl-inpaint` (Replicate or Stability)
**Let the auto-selection do its job** - it's optimized for these use cases!
+300
View File
@@ -0,0 +1,300 @@
# Public Domain Carved Eye Sources
Where to find high-quality images of carved eyes from classical sculptures (all public domain).
---
## Best Museums with Public Domain Images
### 1. Metropolitan Museum of Art (CC0 Public Domain)
**Website:** https://www.metmuseum.org/art/collection
**Search tips:**
- Search: "greek statue marble head"
- Search: "roman portrait bust"
- Filter: "Public Domain" only
- Download: Click "Download" for high-resolution
**Great examples:**
- Greek Kouros heads (Archaic period)
- Roman portrait busts
- Hellenistic marble sculptures
**Direct collections:**
- Greek & Roman Art: https://www.metmuseum.org/art/collection/search#!?department=13
- Filter by "Images" → "Public Domain"
---
### 2. Smithsonian Open Access (CC0)
**Website:** https://www.si.edu/openaccess
**Features:**
- 3 million+ images
- All CC0 (no copyright restrictions)
- High-resolution downloads
**Search:**
- "roman marble head"
- "greek sculpture eyes"
- "classical portrait bust"
**API available:** https://api.si.edu/openaccess/api/v1.0/
---
### 3. Getty Museum (Open Content)
**Website:** https://www.getty.edu/art/collection/
**Search tips:**
- Filter: "Open Content Program"
- Greek and Roman antiquities
- High-resolution IIIF images
**Great for:**
- Archaic Greek sculptures
- Classical period heads
- Detailed close-ups
---
### 4. Rijksmuseum (Public Domain)
**Website:** https://www.rijksmuseum.nl/en/rijksstudio
**Features:**
- Rijksstudio (free download tool)
- High-resolution images
- Classical sculpture collection
---
### 5. British Museum (CC BY-NC-SA 4.0)
**Website:** https://www.britishmuseum.org/collection
**Note:** Some restrictions, but many images free for non-commercial use
**Great for:**
- Egyptian carved eyes
- Greek marble heads
- Roman portraits
---
### 6. Louvre Collections
**Website:** https://collections.louvre.fr/en/
**Search:** "sculpture greek head" or "sculpture roman portrait"
**Note:** Check individual image licenses
---
## How to Find the Perfect Eyes
### Search Strategy
1. **Search for heads/busts, not full statues:**
- "greek marble head"
- "roman portrait bust"
- "classical sculpture face"
2. **Specific periods:**
- "archaic greek kouros" (serene, stylized)
- "classical greek sculpture" (idealized, peaceful)
- "hellenistic sculpture" (emotional, dramatic)
- "roman portrait" (realistic, wise)
3. **Look for close-ups:**
- Museums often provide detail shots
- Check "zoom" or "IIIF viewer" options
---
## Recommended Starting Collection
### Serene/Peaceful Eyes
**Greek Classical Period (450-400 BCE):**
- Doryphoros (Spear Bearer) type
- Athena heads
- Apollo statues
- Smooth, idealized features
- Almond-shaped eyes
- Minimal lid detail
**Best sources:** Met Museum, Getty
---
### Fierce/Intense Eyes
**Hellenistic Period (323-31 BCE):**
- Alexander the Great portraits
- Dying Gaul
- Laocoon group
- Dramatic expressions
- Deep-set eyes
- Strong brow ridges
**Best sources:** Smithsonian, British Museum
---
### Wise/Aged Eyes
**Roman Republican Period:**
- Senator portraits
- Veristic portraits
- Realistic aging details
- Detailed wrinkles
- Saggy eyelids
- Life-like features
**Best sources:** Met Museum, Getty
---
### Stylized/Archaic Eyes
**Greek Archaic Period (700-480 BCE):**
- Kouros statues
- Kore statues
- Almond-shaped
- Simplified forms
- "Archaic smile"
- Clean, simple carving
**Best sources:** Getty, Met Museum
---
## How to Download and Crop
### Step 1: Find the Statue
Example: Met Museum
1. Go to https://www.metmuseum.org/art/collection
2. Search: "roman portrait marble"
3. Filter: Public Domain only
4. Click on a good example
### Step 2: Download High-Res
1. Click "Download" button
2. Choose largest size (usually 4000px+)
3. Save to your computer
### Step 3: Crop the Eyes
Use any image editor (Photoshop, GIMP, etc.):
1. Open the full statue image
2. Zoom in on one eye
3. Crop just the eye area:
- Include: eyeball, eyelids, tear duct, socket
- Leave some surrounding area for context
- Square or slightly rectangular crop
4. Save as PNG:
- `greek_serene_left.png`
- `roman_fierce_right.png`
- etc.
5. Repeat for other eye (if different)
### Step 4: Organize
Place cropped eyes in:
```
./backend/scripts/seed_data/eyes/
├── greek_serene_left.png
├── greek_serene_right.png
├── roman_fierce_left.png
├── roman_fierce_right.png
├── greek_peaceful_left.png
└── ...
```
### Step 5: Run Seed Script
```bash
cd backend
python scripts/seed_eye_catalog.py
```
---
## Recommended Starting Collection (10 Eyes)
To start, get these 10 eyes:
### Greek Classical (Serene)
1. Left eye - Greek marble head
2. Right eye - Greek marble head
### Greek Archaic (Stylized/Peaceful)
3. Left eye - Kouros statue
4. Right eye - Kouros statue
### Hellenistic (Fierce/Dramatic)
5. Left eye - Alexander portrait
6. Right eye - Alexander portrait
### Roman Republican (Wise/Aged)
7. Left eye - Roman senator bust
8. Right eye - Roman senator bust
### Roman Imperial (Powerful)
9. Left eye - Emperor portrait
10. Right eye - Emperor portrait
This gives you 5 emotional ranges × 2 eyes = 10 eyes to start!
---
## Quick Links
- **Met Museum Collection:** https://www.metmuseum.org/art/collection/search#!?department=13&showOnly=openAccess
- **Smithsonian Open Access:** https://www.si.edu/openaccess
- **Getty Open Content:** https://www.getty.edu/about/whatwedo/opencontent.html
- **Rijksmuseum API:** https://data.rijksmuseum.nl/object-metadata/api/
---
## Legal Notes
- **CC0/Public Domain:** Use freely for any purpose
- **CC BY:** Must credit the source
- **CC BY-NC:** Non-commercial use only
- **Always check** individual image licenses
For commercial carving business, stick to **CC0** or **Public Domain** images.
---
## Tips for Best Results
1. **High resolution:** Download largest size available (2000px+ minimum)
2. **Good lighting:** Look for evenly lit photographs
3. **Straight-on angle:** Avoid extreme angles
4. **Clear detail:** Can you see the eyelid lines clearly?
5. **Minimal damage:** Choose well-preserved sculptures
---
## Next Steps
1. Browse the museums above
2. Download 10-20 good eye examples
3. Crop them in an image editor
4. Place in `backend/scripts/seed_data/eyes/`
5. Run the seed script
6. Your catalog is ready!
**You'll have a library of proven carved eyes from master sculptors spanning 2000+ years!**
+350
View File
@@ -0,0 +1,350 @@
# Quick Start Guide
## How to Choose the Right AI Model
### For Body Parts (Hands, Faces, Bodies)
Use **Replicate with `realistic-vision`** model:
```env
AI_PROVIDER=replicate
REPLICATE_API_KEY=your-key-here
REPLICATE_MODEL=realistic-vision
```
**Why:** This model is specifically trained on human anatomy and handles difficult features like:
- ✅ Hands (even complex finger positions)
- ✅ Faces and expressions
- ✅ Skin textures
- ✅ Body proportions
**Cost:** ~$0.020/image
### For Removing Objects
Use **Replicate with `lama`** model:
```env
AI_PROVIDER=replicate
REPLICATE_MODEL=lama
```
**Why:** Designed specifically for inpainting and removal
**Cost:** ~$0.002/image (cheapest!)
### For General Edits (Landscapes, Objects, Creative)
Use **Replicate with `sdxl-inpaint`** model (default):
```env
AI_PROVIDER=replicate
REPLICATE_MODEL=sdxl-inpaint
```
**Cost:** ~$0.025/image
---
## Auto-Model Selection
The system automatically picks the best model based on your prompt:
| Your Prompt | Auto-Selected Model | Why |
|-------------|-------------------|-----|
| "Fix the hand" | realistic-vision | Detects "hand" keyword |
| "Remove person" | lama | Detects "remove" keyword |
| "Change sky to sunset" | sdxl-inpaint | General purpose default |
**You don't need to manually specify models** - the auto-selection is optimized for quality and cost!
---
## Patch Library: Save and Reuse Parts
### What is the Patch Library?
A library where you can save image patches (regions) and reuse them across different images.
**Use Cases:**
- Save a well-generated hand to reuse later
- Save a perfect face for multiple photos
- Build a collection of good body parts
- Save textures, objects, or backgrounds
- Reuse AI-generated elements that came out great
### How to Save a Patch
#### Option 1: Save AI-Generated Result
After an AI edit completes:
```bash
POST /patches/
{
"name": "Perfect Hand",
"description": "Well-formed left hand, palm up",
"source_type": "ai_generated",
"source_edit_id": 123,
"category": "hand",
"tags": "left, palm, realistic"
}
```
This saves the AI-generated output (`patch_out.png`) to your library.
#### Option 2: Save Manual Selection
Select any region from your current image:
```bash
POST /patches/
{
"name": "Good Face",
"description": "Frontal face with good lighting",
"source_type": "manual_selection",
"source_project_id": 456,
"bbox": {"x": 100, "y": 100, "width": 200, "height": 200},
"category": "face",
"tags": "front, smile, female"
}
```
This saves whatever is currently in that region of your image.
#### Option 3: Import from File
Upload an external image:
```bash
POST /patches/
FormData:
name: "Downloaded Hand"
source_type: "imported"
file: [uploaded PNG file]
category: "hand"
```
### How to Apply a Saved Patch
```bash
POST /patches/apply
{
"project_id": 789,
"patch_id": 123,
"bbox": {"x": 300, "y": 400, "width": 200, "height": 200},
"feather_px": 10
}
```
This places the saved patch at the specified location in your image.
### Browse Your Patch Library
```bash
# List all patches
GET /patches/
# Filter by category
GET /patches/?category=hand
# Filter by tags
GET /patches/?tags=realistic
# Get specific patch
GET /patches/123
# Get patch image
GET /patches/123/image
# Get patch thumbnail
GET /patches/123/image?thumbnail=true
```
### Organize Your Patches
**Categories:**
- `hand` - Hand images
- `face` - Facial features
- `body` - Body parts
- `object` - Objects and items
- `texture` - Textures and patterns
- `background` - Backgrounds and scenery
**Tags:** Comma-separated keywords for searching
- "left, palm, realistic"
- "front, smile, female"
- "five fingers, open hand"
---
## Complete Workflow Example
### Scenario: Fix hands in a portrait photo
**Step 1: Create project and upload image**
```bash
POST /projects/ {"name": "Portrait Edit"}
POST /projects/1/upload [upload photo]
```
**Step 2: Try to fix the hand with AI**
```bash
POST /edits/projects/1/fix
{
"prompt": "realistic human hand with five fingers, natural pose",
"mode": "B", # Use full image for context
"selection_type": "rectangle",
"bbox": {"x": 200, "y": 300, "width": 150, "height": 200},
"feather_px": 10
}
```
The system auto-selects `realistic-vision` model because prompt mentions "hand".
**Step 3: If result is good, save it for later**
```bash
POST /patches/
{
"name": "Good Left Hand",
"source_type": "ai_generated",
"source_edit_id": 1,
"category": "hand",
"tags": "left, natural, realistic, five fingers"
}
```
**Step 4: Use saved hand on another photo**
```bash
# On a different project
POST /patches/apply
{
"project_id": 2,
"patch_id": 1,
"bbox": {"x": 150, "y": 250, "width": 150, "height": 200},
"feather_px": 15
}
```
---
## Cost Comparison
### Example: Fixing 10 hands in different photos
**Option A: Generate each hand with AI**
- 10 edits × $0.020 = **$0.20**
**Option B: Generate one good hand, save it, reuse it**
- 1 AI generation: $0.020
- 9 patch applications: $0.00 (no AI cost)
- **Total: $0.020** (90% savings!)
### When to Use Saved Patches vs AI
**Use Saved Patches When:**
- You have a perfect result you want to reuse
- Same angle/lighting/style needed
- Want to maintain consistency across images
- Want to avoid AI generation costs
**Use AI Generation When:**
- Need unique/different result each time
- Different angle or perspective needed
- Want variation and creativity
- Patch doesn't fit the context
---
## Pro Tips
### Building a Good Patch Library
1. **Save your best AI results** - When AI generates something great, save it immediately
2. **Organize with categories** - Use consistent categories for easy finding
3. **Tag descriptively** - Include orientation (left/right), pose, lighting, etc.
4. **Create variations** - Save multiple versions of common needs (left hand, right hand, etc.)
5. **Build gradually** - Your library becomes more valuable over time
### Maximizing Quality
1. **For hands:** Always use `realistic-vision` model or save good results
2. **For faces:** Use Mode B (full image context) for better matching
3. **Use high feather values** (15-20px) when applying saved patches
4. **Test positioning** before finalizing - patches work best when lighting/angle matches
### Saving Money
1. **Build a patch library** of common needs
2. **Use `lama` for removals** instead of expensive models
3. **Let auto-selection work** - it picks the cheapest appropriate model
4. **Reuse successful patches** instead of regenerating
---
## API Quick Reference
```bash
# List available patches
GET /patches/
# Get patch details
GET /patches/{id}
# Get patch image
GET /patches/{id}/image
GET /patches/{id}/image?thumbnail=true
# Create patch from AI edit
POST /patches/
{
"name": "My Patch",
"source_type": "ai_generated",
"source_edit_id": 123,
"category": "hand"
}
# Create patch from manual selection
POST /patches/
{
"name": "My Patch",
"source_type": "manual_selection",
"source_project_id": 456,
"bbox": {"x": 100, "y": 100, "width": 200, "height": 200}
}
# Apply saved patch
POST /patches/apply
{
"project_id": 789,
"patch_id": 123,
"bbox": {"x": 300, "y": 400, "width": 200, "height": 200},
"feather_px": 10
}
# Delete patch
DELETE /patches/{id}
# Update patch metadata
PUT /patches/{id}
{
"name": "Updated Name",
"tags": "new, tags",
"category": "hand"
}
```
---
## Summary
**For hands/faces/bodies:** Use `realistic-vision` model
**For removal:** Use `lama` model
**For general edits:** Use `sdxl-inpaint` (default)
**Auto-selection works great** - just write natural prompts
**Save good AI results** to patch library for reuse
**Save manual selections** from any image
**Reuse patches across images** to save money and maintain consistency
**You now have the best of both worlds:**
- AI generation when you need something new
- Saved patches when you need consistency or want to save money