leonmak / oot_diffusion

Packaged version of OOTDiffusion

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OOTDiffusion

A packaged version of OOTDiffusion that works with Pip.

No need to manually download models, checkpoints, weights etc. Should work out if the box.

Needs CUDA and GPU

OOTDiffusion 的打包版本

Try on Replicate

Instructions

pip install git+https://github.com/viktorfa/oot_diffusion.git

Examples for Colab. But can be used anywhere.

If you don't set hg_root, a folder called ootd_models will be created in your working dir.

Load model

from oot_diffusion import OOTDiffusionModel
from PIL import Image
from pathlib import Path


def get_ootd_model():
  model = OOTDiffusionModel(
    hg_root="/content/models",
    cache_dir="/content/drive/MyDrive/hf_cache",
  )
  return model

Generate image

def generate_image():
  model = get_ootd_model()
  generated_images, mask_image = model.generate(
      model_path="/YOUR_MODEL.jpg",
      cloth_path="/YOUR_GARMENT.jpg",
      steps=10,
      cfg=2.0,
      num_samples=2,
    )

  return generated_images, mask_image


generated_images, mask_image = generate_image()

Display images

from IPython.display import display

for image in generated_images:
  display(image)

display(mask_image)

Credits

The original authors of OOTDiffusion

The authors of ComfyUI-OOTDiffusion, who made it easier to package the code.

Official implementation

See oms-Diffusion for the official implementation of OOTDiffusion.

About

Packaged version of OOTDiffusion

License:Apache License 2.0


Languages

Language:Python 95.9%Language:Cuda 2.6%Language:C++ 1.4%Language:C 0.1%