fix: prevent extra legs from garment reference bleeding into lower bodyTwo fixes for the 'three legs' artifact:1. Prompt: add explicit 'exactly two legs' constraint to upper-body prompt2. Crop: upper-body garments are cropped to top 75% before being used as the reference latent β hanging ties, drawstrings and tails in the bottom quarter were being read as limbs by the model
improve: richer garment description + stronger prompt + 16 steps + 2MP ref- describe_garment now detects sleeve type, neckline, and special features (tie/bow, buttons, ruffles, etc.) using CLIP zero-shot β gives the model a much more specific caption to work from- Prompts now explicitly instruct the model to preserve sleeve shape, neckline, silhouette, and decorative elements without simplifying- Steps: 12 β 16 (better detail at ~25% more inference time)- Clothing reference: 1.5 β 2.0 megapixels (more detail in the conditioning)
fix: remove CLIP from main process to fix ZeroGPU bad-fork RuntimeErrorZeroGPU uses fork() for workers. Any CUDA/PyTorch init in the parentprocess poisons the fork (_is_in_bad_fork). _preprocess_garment wascalling CLIPModel in the main Gradio process via clothing_input.change(),which initialised CUDA before the fork. Fix: remove that change() event.All CLIP calls (detect_specific_garment, describe_garment, classify_garment)are now inside _run_generate() which runs post-fork in the ZeroGPU worker.
refactor: move CLIP inference outside @spaces.GPU to fix RuntimeError- All CLIP calls (detect_specific_garment, describe_garment, classify_garment) now run in _preprocess_garment() which is triggered by clothing_input.change() β completely outside @spaces.GPU, no GPU allocation needed for CPU inference- generate() now receives pre-computed garment info via gr.State (no CLIP inside GPU)- Added _run_generate() as the actual implementation; generate() wraps it with try/except that surfaces real error messages in the UI instead of bare RuntimeError- rembg still uses CPUExecutionProvider to avoid onnxruntime CUDA conflicts