Linoy Tsaban commited on
Commit
87c0592
1 Parent(s): 83fc3c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -22
app.py CHANGED
@@ -120,15 +120,11 @@ def invert_and_reconstruct(
120
  skip=36,
121
  tar_cfg_scale=15,
122
  # neg_guidance=False,
123
- seed =0,
124
- left = 0,
125
- right = 0,
126
- top = 0,
127
- bottom = 0
128
  ):
129
- # offsets=(0,0,0,0)
130
  torch.manual_seed(seed)
131
- x0 = load_512(input_image, left,right, top, bottom, device)
132
 
133
 
134
  # invert
@@ -164,9 +160,10 @@ def edit(input_image,
164
  torch.manual_seed(seed)
165
  # if not bool(inversion_map):
166
  # raise gr.Error("Must invert before editing")
167
- # latnets, zs, wts = inversion_map['latnets'],inversion_map['zs'],inversion_map['wts']
168
 
169
- x0 = load_512(input_image, left,right, top, bottom, device)
 
 
170
 
171
  # invert
172
  # wt, zs, wts = invert(x0 =x0 , prompt_src=src_prompt, num_diffusion_steps=steps, cfg_scale_src=src_cfg_scale)
@@ -268,13 +265,6 @@ with gr.Blocks() as demo:
268
  sega_edit_guidance = gr.Slider(value=10, label=f"SEGA Edit Guidance Scale", interactive=True)
269
  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...")
270
 
271
- #shift
272
- with gr.Column():
273
- left = gr.Number(value=0, precision=0, label="Left Shift", interactive=True)
274
- right = gr.Number(value=0, precision=0, label="Right Shift", interactive=True)
275
- top = gr.Number(value=0, precision=0, label="Top Shift", interactive=True)
276
- bottom = gr.Number(value=0, precision=0, label="Bottom Shift", interactive=True)
277
-
278
 
279
  # neg_guidance = gr.Checkbox(label="SEGA Negative Guidance")
280
 
@@ -291,11 +281,7 @@ with gr.Blocks() as demo:
291
  skip,
292
  tar_cfg_scale,
293
  # neg_guidance,
294
- seed,
295
- left,
296
- right,
297
- top,
298
- bottom
299
  ],
300
  outputs=[ddpm_edited_image],
301
  )
@@ -313,7 +299,7 @@ with gr.Blocks() as demo:
313
  sega_edit_guidance,
314
  warm_up,
315
  # neg_guidance,
316
- seed,
317
 
318
  ],
319
  outputs=[sega_edited_image],
 
120
  skip=36,
121
  tar_cfg_scale=15,
122
  # neg_guidance=False,
123
+ seed =0
 
 
 
 
124
  ):
125
+ offsets=(0,0,0,0)
126
  torch.manual_seed(seed)
127
+ x0 = load_512(input_image, **offsets, device)
128
 
129
 
130
  # invert
 
160
  torch.manual_seed(seed)
161
  # if not bool(inversion_map):
162
  # raise gr.Error("Must invert before editing")
 
163
 
164
+
165
+ offsets = (0,0,0,0)
166
+ x0 = load_512(input_image, **offsets, device)
167
 
168
  # invert
169
  # wt, zs, wts = invert(x0 =x0 , prompt_src=src_prompt, num_diffusion_steps=steps, cfg_scale_src=src_cfg_scale)
 
265
  sega_edit_guidance = gr.Slider(value=10, label=f"SEGA Edit Guidance Scale", interactive=True)
266
  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...")
267
 
 
 
 
 
 
 
 
268
 
269
  # neg_guidance = gr.Checkbox(label="SEGA Negative Guidance")
270
 
 
281
  skip,
282
  tar_cfg_scale,
283
  # neg_guidance,
284
+ seed
 
 
 
 
285
  ],
286
  outputs=[ddpm_edited_image],
287
  )
 
299
  sega_edit_guidance,
300
  warm_up,
301
  # neg_guidance,
302
+ seed
303
 
304
  ],
305
  outputs=[sega_edited_image],