Spaces:
Configuration error
Configuration error
from PIL import Image | |
import torch | |
from openpose import get_openpose, init as init_openpose | |
from adapter_model import MODEL | |
init_openpose() | |
ip_model = MODEL("pose") | |
def generate(img_human: Image, img_clothes: Image): | |
img_human = img_human.resize((512, 512)) | |
img_clothes = img_clothes.resize((512, 768)) | |
img_openpose = get_openpose(img_human) | |
img_openpose_gen = ip_model.model.generate( | |
pil_image=img_clothes, | |
image=img_openpose, | |
width=512, | |
height=768, | |
num_samples=1, | |
num_inference_steps=30, | |
seed=42 | |
).images[0] | |
torch.cuda.empty_cache() | |
return img_openpose_gen.convert("RGB") | |