Linoy Tsaban commited on
Commit
c0aaf41
1 Parent(s): c8c4b36

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -22,7 +22,7 @@ def invert(x0, prompt_src="", num_diffusion_steps=100, cfg_scale_src = 3.5, eta
22
  sd_pipe.scheduler.set_timesteps(num_diffusion_steps)
23
 
24
  # vae encode image
25
- w0 = (sd_pipe.vae.encode(pil_to_tensor(x0).astype(torch.float16)).latent_dist.mode() * 0.18215).float()
26
 
27
  # find Zs and wts - forward process
28
  wt, zs, wts = inversion_forward_process(sd_pipe, w0, etas=eta, prompt=prompt_src, cfg_scale=cfg_scale_src, prog_bar=True, num_inference_steps=num_diffusion_steps)
@@ -55,6 +55,7 @@ def edit(input_image, input_image_prompt='', target_prompt='', edit_prompt='',
55
  edit_guidance_scale=8, guidance_scale=15, skip=36, num_diffusion_steps=100,
56
  ):
57
  offsets=(0,0,0,0)
 
58
  x0 = load_512(input_image, *offsets, device)
59
 
60
 
@@ -91,7 +92,7 @@ inputs = [
91
  gr.Textbox(label="target prompt"),
92
  gr.Textbox(label="SEGA edit concept"),
93
  gr.Checkbox(label="SEGA negative_guidance"),
94
- gr.Slider(label="warmup steps", minimum=7, maximum=18, value=15),
95
  gr.Slider(label="edit guidance scale", minimum=0, maximum=15, value=3.5),
96
  gr.Slider(label="guidance scale", minimum=7, maximum=18, value=15),
97
  gr.Slider(label="skip", minimum=0, maximum=40, value=36),
 
22
  sd_pipe.scheduler.set_timesteps(num_diffusion_steps)
23
 
24
  # vae encode image
25
+ w0 = (sd_pipe.vae.encode(x0).latent_dist.mode() * 0.18215).float()
26
 
27
  # find Zs and wts - forward process
28
  wt, zs, wts = inversion_forward_process(sd_pipe, w0, etas=eta, prompt=prompt_src, cfg_scale=cfg_scale_src, prog_bar=True, num_inference_steps=num_diffusion_steps)
 
55
  edit_guidance_scale=8, guidance_scale=15, skip=36, num_diffusion_steps=100,
56
  ):
57
  offsets=(0,0,0,0)
58
+ input_image = pil_to_tensor(input_image).type(torch.float16))
59
  x0 = load_512(input_image, *offsets, device)
60
 
61
 
 
92
  gr.Textbox(label="target prompt"),
93
  gr.Textbox(label="SEGA edit concept"),
94
  gr.Checkbox(label="SEGA negative_guidance"),
95
+ gr.Slider(label="warmup steps", minimum=1, maximum=30, value=5),
96
  gr.Slider(label="edit guidance scale", minimum=0, maximum=15, value=3.5),
97
  gr.Slider(label="guidance scale", minimum=7, maximum=18, value=15),
98
  gr.Slider(label="skip", minimum=0, maximum=40, value=36),