yue-here commited on
Commit
e81087c
1 Parent(s): 77e2e9d

updating app and utils

Browse files
Files changed (2) hide show
  1. app.py +4 -2
  2. glyffuser_utils.py +2 -1
app.py CHANGED
@@ -8,11 +8,13 @@ pipeline.scheduler = DPMSolverMultistepScheduler()
8
  def infer(text, steps):
9
  generated_images = pipeline(
10
  text,
11
- batch_size=1, # Generate one image at a time for each step
12
  num_inference_steps=int(steps)
13
  ).images
14
 
15
  return generated_images[0]
16
 
17
- demo = gr.Interface(fn=infer, inputs=["text", "number"], outputs="image")
 
 
18
  demo.launch()
 
8
  def infer(text, steps):
9
  generated_images = pipeline(
10
  text,
11
+ batch_size=1,
12
  num_inference_steps=int(steps)
13
  ).images
14
 
15
  return generated_images[0]
16
 
17
+ demo = gr.Interface(fn=infer, inputs=["text", "number"], outputs="image"
18
+ description="English text to Chinese glyph. Recommend <10 steps as this space is not running on GPU",
19
+ )
20
  demo.launch()
glyffuser_utils.py CHANGED
@@ -141,7 +141,8 @@ class GlyffuserPipeline(DiffusionPipeline):
141
  # 2. compute previous image: x_t -> x_t-1
142
  image = self.scheduler.step(model_output, t, image, generator=generator, return_dict=False)[0]
143
 
144
- image = (image / 2 + 0.5).clamp(0, 1)
 
145
  image = image.cpu().permute(0, 2, 3, 1).numpy()
146
  if output_type == "pil":
147
  image = self.numpy_to_pil(image)
 
141
  # 2. compute previous image: x_t -> x_t-1
142
  image = self.scheduler.step(model_output, t, image, generator=generator, return_dict=False)[0]
143
 
144
+ # image = (image / 2 + 0.5).clamp(0, 1)
145
+ image = image.clamp(0, 1)
146
  image = image.cpu().permute(0, 2, 3, 1).numpy()
147
  if output_type == "pil":
148
  image = self.numpy_to_pil(image)