angtrim commited on
Commit
ddaa35b
·
verified ·
1 Parent(s): 14a8f19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -4
app.py CHANGED
@@ -73,8 +73,7 @@ def pil_image_to_data_uri(img, format='PNG'):
73
  return f"data:image/{format.lower()};base64,{img_str}"
74
 
75
 
76
- def run(image, prompt, prompt_template, style_name, seed, val_r):
77
- print(f"seed: {seed}, r_val: {val_r}")
78
  print("sketch updated")
79
  if image is None:
80
  ones = Image.new("L", (512, 512), 255)
@@ -84,10 +83,9 @@ def run(image, prompt, prompt_template, style_name, seed, val_r):
84
  image = image.convert("RGB")
85
  image_t = TF.to_tensor(image) > 0.5
86
  image_pil = TF.to_pil_image(image_t.to(torch.float32))
87
- print(f"r_val={val_r}, seed={seed}")
88
  with torch.no_grad():
89
  c_t = image_t.unsqueeze(0).cuda().float()
90
- torch.manual_seed(seed)
91
  B,C,H,W = c_t.shape
92
  noise = torch.randn((1,4,H//8, W//8), device=c_t.device)
93
  output_image = model(c_t, prompt, deterministic=False, r=val_r, noise_map=noise)
 
73
  return f"data:image/{format.lower()};base64,{img_str}"
74
 
75
 
76
+ def run(image, prompt, prompt_template, style_name):
 
77
  print("sketch updated")
78
  if image is None:
79
  ones = Image.new("L", (512, 512), 255)
 
83
  image = image.convert("RGB")
84
  image_t = TF.to_tensor(image) > 0.5
85
  image_pil = TF.to_pil_image(image_t.to(torch.float32))
 
86
  with torch.no_grad():
87
  c_t = image_t.unsqueeze(0).cuda().float()
88
+ torch.manual_seed(42)
89
  B,C,H,W = c_t.shape
90
  noise = torch.randn((1,4,H//8, W//8), device=c_t.device)
91
  output_image = model(c_t, prompt, deterministic=False, r=val_r, noise_map=noise)