MCPcopy Create free account
hub / github.com/YesianRohn/TextSSR / encode

Method encode

diffusers/examples/community/magic_mix.py:33–37  ·  view source on GitHub ↗
(self, img)

Source from the content-addressed store, hash-verified

31
32 # convert PIL image to latents
33 def encode(self, img):
34 with torch.no_grad():
35 latent = self.vae.encode(tfms.ToTensor()(img).unsqueeze(0).to(self.device) * 2 - 1)
36 latent = 0.18215 * latent.latent_dist.sample()
37 return latent
38
39 # convert latents to PIL image
40 def decode(self, latent):

Callers 15

__call__Method · 0.95
__call__Method · 0.45
build_indexMethod · 0.45
__getitem__Method · 0.45
mainFunction · 0.45
run_ruffFunction · 0.45
test_latents_inputMethod · 0.45
test_latents_inputMethod · 0.45
test_latents_inputMethod · 0.45

Calls 2

toMethod · 0.45
sampleMethod · 0.45