MCPcopy Create free account
hub / github.com/OpenGVLab/DragGAN / on_change_model

Function on_change_model

draggan/web.py:120–140  ·  view source on GitHub ↗
(selected, model)

Source from the content-addressed store, hash-verified

118
119
120def on_change_model(selected, model):
121 size = CKPT_SIZE[selected]
122
123 G = draggan.load_model(utils.get_path(selected), device=device)
124 model = {'G': G}
125 W = draggan.generate_W(
126 G,
127 seed=int(1),
128 device=device,
129 truncation_psi=0.8,
130 truncation_cutoff=8,
131 )
132 img, _ = draggan.generate_image(W, G, device=device)
133
134 state = {
135 'W': W,
136 'img': img,
137 'history': []
138 }
139
140 return model, state, img, img, size
141
142
143def on_new_image(model, seed):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected