Linoy Tsaban commited on
Commit
bc09c01
1 Parent(s): fd93e8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -26
app.py CHANGED
@@ -121,6 +121,7 @@ def invert_and_reconstruct(
121
  skip=36,
122
  tar_cfg_scale=15,
123
  # neg_guidance=False,
 
124
  left = 0,
125
  right = 0,
126
  top = 0,
@@ -160,28 +161,9 @@ def edit(input_image,
160
  sega_edit_guidance=0,
161
  warm_up=None,
162
  # neg_guidance=False,
163
- left = 0,
164
- right = 0,
165
- top = 0,
166
- bottom = 0):
167
-
168
- # # offsets=(0,0,0,0)
169
- # x0 = load_512(input_image, left,right, top, bottom, device)
170
-
171
-
172
- # # invert
173
- # # wt, zs, wts = invert(x0 =x0 , prompt_src=src_prompt, num_diffusion_steps=steps, cfg_scale_src=src_cfg_scale)
174
- # wt, zs, wts = invert(x0 =x0 , prompt_src=src_prompt, num_diffusion_steps=steps)
175
-
176
- # latnets = wts[skip].expand(1, -1, -1, -1)
177
 
178
-
179
- # #pure DDPM output
180
- # pure_ddpm_out = sample(wt, zs, wts, prompt_tar=tar_prompt,
181
- # cfg_scale_tar=tar_cfg_scale, skip=skip)
182
-
183
- # if not edit_concept or not sega_edit_guidance:
184
- # return pure_ddpm_out, pure_ddpm_out
185
  if not bool(inversion_map):
186
  raise gr.Error("Must invert before editing")
187
  latnets, zs, wts = inversion_map['latnets'],inversion_map['zs'],inversion_map['wts']
@@ -275,7 +257,7 @@ with gr.Blocks() as demo:
275
  # reconstruction
276
  skip = gr.Slider(minimum=0, maximum=40, value=36, precision=0, label="Skip Steps", interactive=True)
277
  tar_cfg_scale = gr.Slider(minimum=7, maximum=18,value=15, label=f"Guidance Scale", interactive=True)
278
-
279
  with gr.Column():
280
  sega_edit_guidance = gr.Slider(value=10, label=f"SEGA Edit Guidance Scale", interactive=True)
281
  warm_up = gr.Textbox(label=f"SEGA Warm-up Steps", interactive=True, placeholder="type #warm-up steps for each concpets (e.g. 2,7,5...")
@@ -303,6 +285,7 @@ with gr.Blocks() as demo:
303
  skip,
304
  tar_cfg_scale,
305
  # neg_guidance,
 
306
  left,
307
  right,
308
  top,
@@ -324,10 +307,8 @@ with gr.Blocks() as demo:
324
  sega_edit_guidance,
325
  warm_up,
326
  # neg_guidance,
327
- left,
328
- right,
329
- top,
330
- bottom
331
  ],
332
  outputs=[sega_edited_image],
333
  )
 
121
  skip=36,
122
  tar_cfg_scale=15,
123
  # neg_guidance=False,
124
+ seed =0,
125
  left = 0,
126
  right = 0,
127
  top = 0,
 
161
  sega_edit_guidance=0,
162
  warm_up=None,
163
  # neg_guidance=False,
164
+ seed =0,
165
+ ):
 
 
 
 
 
 
 
 
 
 
 
 
166
 
 
 
 
 
 
 
 
167
  if not bool(inversion_map):
168
  raise gr.Error("Must invert before editing")
169
  latnets, zs, wts = inversion_map['latnets'],inversion_map['zs'],inversion_map['wts']
 
257
  # reconstruction
258
  skip = gr.Slider(minimum=0, maximum=40, value=36, precision=0, label="Skip Steps", interactive=True)
259
  tar_cfg_scale = gr.Slider(minimum=7, maximum=18,value=15, label=f"Guidance Scale", interactive=True)
260
+ seed = gr.Number(value=0, precision=0, label="Seed", interactive=True)
261
  with gr.Column():
262
  sega_edit_guidance = gr.Slider(value=10, label=f"SEGA Edit Guidance Scale", interactive=True)
263
  warm_up = gr.Textbox(label=f"SEGA Warm-up Steps", interactive=True, placeholder="type #warm-up steps for each concpets (e.g. 2,7,5...")
 
285
  skip,
286
  tar_cfg_scale,
287
  # neg_guidance,
288
+ seed,
289
  left,
290
  right,
291
  top,
 
307
  sega_edit_guidance,
308
  warm_up,
309
  # neg_guidance,
310
+ seed,
311
+
 
 
312
  ],
313
  outputs=[sega_edited_image],
314
  )