INNER CODE UNIT · Python
h
Shilin-LU/TF-ICON · scripts/app.py:75
w, h = map(lambda x: x - x % 64, (w, h)) # resize to integer multiple of 64
w = h = 512
image = image.resize((w, h), resample=PIL.Image.LANCZOS)
image = np.array(image).astype(np.float32) / 255.0
image = image[None].transpose(0, 3, 1, 2)
image = torch.from_numpy(image)
if pad or seg_map:
return 2. * image - 1., new_w, new_h, padded_segmentation_map
return 2. * image - 1., w, h
def load_model_and_get_prompt_embedding(model, scale, device, prompts, inv=False):
if inv:
inv_emb = model.get_learned_conditioning(prompts, inv)