Files
PaintPlus/scripts
Claude fe4d911a00 Dynamic GPU capability detection: probe CC, VRAM, feature flags, pick best model
Replaces fixed tier table with real hardware probing and dynamic model selection.

gpu_detect.py — complete rewrite:
- Reads torch.cuda.get_device_properties + mem_get_info for actual free VRAM
- Detects: fp16 (CC≥6.0), bf16 (CC≥8.0), fp8 (CC≥8.9 Ada/Hopper),
           int8 (CC≥7.0), tensor_cores (CC≥7.0), xformers presence
- Pre-Pascal (CC<6.0): effective_vram halved (fp32 weights are 2× larger)
- Subtracts 400MB driver overhead from free VRAM before model selection
- _select_txt2img / _select_inpaint / _select_img2img / _select_upscale:
    eff≥20GB  → FLUX.1-schnell (no offload)
    eff≥10GB  → FLUX.1-schnell (model_cpu_offload)
    eff≥7.5GB → SDXL
    eff≥5.5GB → SDXL + attention_slicing
    eff≥3.5GB → SD 2.1
    eff≥2.5GB → SD 2.1-base + attention_slicing
    eff≥1.7GB → SD 1.5
    else      → SD 1.5 + sequential_cpu_offload
- ModelSpec carries: model_id, family, memory_opt, native_res, vram_fp16_gb
- Warnings: old CC, pre-Pascal fp32, fp8 upgrade hint, xformers install tip
- Compatibility shim get_model_ids() retained for existing callers
- infer_spec_from_model_id() auto-detects family from HF_MODEL_* overrides

local_diffusion.py — refactored to use ModelSpec:
- Reads spec from GpuCapabilities.recommended[op] instead of tier table
- FLUX.1-schnell: FluxPipeline / FluxImg2ImgPipeline, 4 steps, guidance=0.0
- SD families: family-aware pipeline class selection (sd15/sd2x/sdxl)
- Memory opts applied per ModelSpec.memory_opt field
- xformers attention enabled automatically when xformers detected

gpu_status.py — richer response:
- Exposes all feature flags (fp16/bf16/fp8/int8/tensor_cores/xformers)
- Returns full ModelSpec per operation (model_id, family, memory_opt, native_res)

ai_tools.py — /api/config exposes:
- gpu_vram_total, gpu_vram_free, gpu_cc, gpu_fp16, gpu_bf16, gpu_fp8,
  gpu_tensor_cores, gpu_eff_vram, local_gpu_warnings

requirements.gpu.txt:
- diffusers bumped to >=0.29.0 (FLUX pipeline added in 0.29)
- transformers bumped to >=4.40.0
- sentencepiece added (FLUX T5 tokenizer)

scripts/gpu_setup.py:
- Prints full model table at startup (op → model_id, family, memory_opt, res)
- Shows all feature flags in one line

https://claude.ai/code/session_01WVDg7amsy1TTtxvpku7bcM
2026-06-13 15:35:37 +00:00
..

Classic Eyes Scripts

This directory contains scripts for generating and importing classic eye images into the AI Photo Edit patch library.

Overview

The scripts generate a variety of classic eye styles that can be used as reusable patches for photo editing:

  • Realistic eyes - Detailed eyes with gradient irises and realistic highlights
  • Anime eyes - Large, expressive eyes in anime style with prominent highlights
  • Cartoon eyes - Simple, bold cartoon-style eyes

Each style is available in multiple iris colors: blue, green, brown, hazel, grey, and amber.

Scripts

1. generate_classic_eyes_ppm.py

Generates classic eye images using only the Python standard library (no dependencies required).

python scripts/generate_classic_eyes_ppm.py

This creates PPM format images in data/classic_eyes_ppm/. PPM is a simple image format that can be converted to PNG later.

2. download_classic_eyes.py

Full-featured script that generates eyes and imports them directly into the patch library. Requires PIL/Pillow.

# Run inside the backend container
docker exec -it ai-photo-edit-backend python /app/../scripts/download_classic_eyes.py

# Or with the API running
python scripts/download_classic_eyes.py --api --base-url http://localhost:8101

# Or save to a directory for later import
python scripts/download_classic_eyes.py --output-dir ./my_eyes

3. startup_import_eyes.py

Converts PPM files to PNG and imports them into the patch library. Run this inside the backend container.

docker exec -it ai-photo-edit-backend python /app/../scripts/startup_import_eyes.py

4. import_saved_eyes.py

Import previously saved eye images from a directory.

python scripts/import_saved_eyes.py /path/to/saved/eyes

Quick Start

  1. Generate the eye images (no dependencies needed):

    python scripts/generate_classic_eyes_ppm.py
    
  2. Start the application:

    docker compose up -d
    
  3. Import the eyes:

    docker exec -it ai-photo-edit-backend python /scripts/startup_import_eyes.py
    
  4. Verify in the app: Open the patch library in the UI to see the imported classic eyes.

Generated Eyes

Style Colors Available Size
Realistic Blue, Green, Brown, Hazel, Grey, Amber 200x200
Anime Blue, Green, Brown, Hazel, Grey, Amber 200x200
Cartoon Blue, Green, Brown, Hazel, Grey, Amber 200x200

Total: 18 unique eye variants

Extending

To add more eye styles or colors, edit the generate_classic_eyes_ppm.py or download_classic_eyes.py scripts:

# Add new color
colors["purple"] = (128, 0, 128)

# Add new style in create_classic_eye() function
elif style == "fantasy":
    # Your custom eye drawing code
    pass

File Formats

  • PPM: Portable Pixmap format - simple, universal, generated without dependencies
  • PNG: Preferred format for the patch library - converted from PPM using PIL

License

The generated eye images are created programmatically and are free to use without restrictions.