Spaces:
Running
on
A10G
Running
on
A10G
Linoy Tsaban
commited on
Commit
·
91668c6
1
Parent(s):
f403525
Update app.py
Browse files
app.py
CHANGED
@@ -53,8 +53,6 @@ def sample(zs, wts, prompt_tar="", skip=36, cfg_scale_tar=15, eta = 1):
|
|
53 |
|
54 |
# load pipelines
|
55 |
sd_model_id = "runwayml/stable-diffusion-v1-5"
|
56 |
-
# sd_model_id = "CompVis/stable-diffusion-v1-4"
|
57 |
-
# sd_model_id = "stabilityai/stable-diffusion-2-base"
|
58 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
59 |
sd_pipe = StableDiffusionPipeline.from_pretrained(sd_model_id).to(device)
|
60 |
sd_pipe.scheduler = DDIMScheduler.from_config(sd_model_id, subfolder = "scheduler")
|
@@ -156,11 +154,6 @@ with gr.Blocks(css='style.css') as demo:
|
|
156 |
seed = 0,
|
157 |
randomize_seed = True):
|
158 |
|
159 |
-
# if randomized_seed:
|
160 |
-
# seed = random.randint(0, np.iinfo(np.int32).max)
|
161 |
-
|
162 |
-
# torch.manual_seed(seed)
|
163 |
-
# # offsets=(0,0,0,0)
|
164 |
x0 = load_512(input_image, device=device)
|
165 |
|
166 |
if do_inversion or randomize_seed:
|
@@ -173,7 +166,6 @@ with gr.Blocks(css='style.css') as demo:
|
|
173 |
return output, wts, zs, do_inversion
|
174 |
|
175 |
gr.HTML(intro)
|
176 |
-
# xt = gr.State(value=False)
|
177 |
wts = gr.State()
|
178 |
zs = gr.State()
|
179 |
do_inversion = gr.State(value=True)
|
@@ -210,7 +202,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
210 |
edit_button.click(
|
211 |
fn = randomize_seed_fn,
|
212 |
inputs = [seed, randomize_seed],
|
213 |
-
outputs = [seed]).then(
|
214 |
fn=edit,
|
215 |
inputs=[input_image,
|
216 |
do_inversion, wts, zs,
|
@@ -235,10 +227,6 @@ with gr.Blocks(css='style.css') as demo:
|
|
235 |
outputs = [do_inversion]
|
236 |
)
|
237 |
|
238 |
-
# skip.change(
|
239 |
-
# fn = reset_latents
|
240 |
-
# )
|
241 |
-
|
242 |
|
243 |
gr.Examples(
|
244 |
label='Examples',
|
|
|
53 |
|
54 |
# load pipelines
|
55 |
sd_model_id = "runwayml/stable-diffusion-v1-5"
|
|
|
|
|
56 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
57 |
sd_pipe = StableDiffusionPipeline.from_pretrained(sd_model_id).to(device)
|
58 |
sd_pipe.scheduler = DDIMScheduler.from_config(sd_model_id, subfolder = "scheduler")
|
|
|
154 |
seed = 0,
|
155 |
randomize_seed = True):
|
156 |
|
|
|
|
|
|
|
|
|
|
|
157 |
x0 = load_512(input_image, device=device)
|
158 |
|
159 |
if do_inversion or randomize_seed:
|
|
|
166 |
return output, wts, zs, do_inversion
|
167 |
|
168 |
gr.HTML(intro)
|
|
|
169 |
wts = gr.State()
|
170 |
zs = gr.State()
|
171 |
do_inversion = gr.State(value=True)
|
|
|
202 |
edit_button.click(
|
203 |
fn = randomize_seed_fn,
|
204 |
inputs = [seed, randomize_seed],
|
205 |
+
outputs = [seed], queue = False).then(
|
206 |
fn=edit,
|
207 |
inputs=[input_image,
|
208 |
do_inversion, wts, zs,
|
|
|
227 |
outputs = [do_inversion]
|
228 |
)
|
229 |
|
|
|
|
|
|
|
|
|
230 |
|
231 |
gr.Examples(
|
232 |
label='Examples',
|