INNER CODE UNIT · Python
image
Shilin-LU/TF-ICON · scripts/app.py:79
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)
c = uc = inv_emb
else:
inv_emb = None