linoyts HF staff commited on
Commit
cd7e306
1 Parent(s): f40fb7c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -42,6 +42,7 @@ def generate(slider_x, prompt, seed, recalc_directions, iterations, steps, guida
42
  # check if avg diff for directions need to be re-calculated
43
  print("slider_x", slider_x)
44
  print("x_concept_1", x_concept_1, "x_concept_2", x_concept_2)
 
45
 
46
  if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]) or recalc_directions:
47
  avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations).to(torch.float16)
@@ -69,6 +70,7 @@ def update_scales(x,prompt,seed, steps, guidance_scale,
69
  img2img_type = None, img = None,
70
  controlnet_scale= None, ip_adapter_scale=None,):
71
  avg_diff = avg_diff_x.cuda()
 
72
  if img2img_type=="controlnet canny" and img is not None:
73
  control_img = process_controlnet_img(img)
74
  image = t5_slider_controlnet.generate(prompt, guidance_scale=guidance_scale, image=control_img, controlnet_conditioning_scale =controlnet_scale, scale=x, seed=seed, num_inference_steps=steps, avg_diff=avg_diff)
 
42
  # check if avg diff for directions need to be re-calculated
43
  print("slider_x", slider_x)
44
  print("x_concept_1", x_concept_1, "x_concept_2", x_concept_2)
45
+ torch.manual_seed(seed)
46
 
47
  if not sorted(slider_x) == sorted([x_concept_1, x_concept_2]) or recalc_directions:
48
  avg_diff = clip_slider.find_latent_direction(slider_x[0], slider_x[1], num_iterations=iterations).to(torch.float16)
 
70
  img2img_type = None, img = None,
71
  controlnet_scale= None, ip_adapter_scale=None,):
72
  avg_diff = avg_diff_x.cuda()
73
+ torch.manual_seed(seed)
74
  if img2img_type=="controlnet canny" and img is not None:
75
  control_img = process_controlnet_img(img)
76
  image = t5_slider_controlnet.generate(prompt, guidance_scale=guidance_scale, image=control_img, controlnet_conditioning_scale =controlnet_scale, scale=x, seed=seed, num_inference_steps=steps, avg_diff=avg_diff)