michaelj commited on
Commit
7d53395
1 Parent(s): a59b14b

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. backend/lcm_text_to_image.py +8 -1
backend/lcm_text_to_image.py CHANGED
@@ -80,6 +80,13 @@ class LCMTextToImage:
80
  beta_end=0.01,
81
  )
82
 
 
 
 
 
 
 
 
83
  def init(
84
  self,
85
  device: str = "cpu",
@@ -97,7 +104,7 @@ class LCMTextToImage:
97
  if lcm_diffusion_setting.diffusion_task == DiffusionTask.image_to_image.value:
98
  w, h = lcm_diffusion_setting.init_image.size
99
  newW = lcm_diffusion_setting.image_width
100
- newH = int(h * newW / w)
101
  lcm_diffusion_setting.image_height=newH
102
  img = lcm_diffusion_setting.init_image.resize((newW, newH))
103
  print("新图",newH,newW, lcm_diffusion_setting.image_height)
 
80
  beta_end=0.01,
81
  )
82
 
83
+ def make_even(self,num):
84
+ if num % 2 == 0:
85
+ return num
86
+ else:
87
+ print("取整了")
88
+ return math.ceil(num)
89
+
90
  def init(
91
  self,
92
  device: str = "cpu",
 
104
  if lcm_diffusion_setting.diffusion_task == DiffusionTask.image_to_image.value:
105
  w, h = lcm_diffusion_setting.init_image.size
106
  newW = lcm_diffusion_setting.image_width
107
+ newH = self.make_even(int(h * newW / w))
108
  lcm_diffusion_setting.image_height=newH
109
  img = lcm_diffusion_setting.init_image.resize((newW, newH))
110
  print("新图",newH,newW, lcm_diffusion_setting.image_height)