lvkaokao commited on
Commit
5da113a
1 Parent(s): 121192a

update app.

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -13,10 +13,13 @@ model_id = "dicoo_model"
13
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float)
14
 
15
  def predict(prompt, steps=30, seed=42, guidance_scale=7.5):
 
 
16
  print("prompt: ", prompt)
17
  print("steps: ", steps)
 
18
  start_time = time.time()
19
- image = pipe(prompt, num_inference_steps=steps, guidance_scale=7.5).images[0]
20
  print("cost: ", time.time() - start_time)
21
  return image
22
 
 
13
  pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float)
14
 
15
  def predict(prompt, steps=30, seed=42, guidance_scale=7.5):
16
+ # cpu info
17
+ # print(subprocess.check_output(["cat /proc/cpuinfo | grep 'model name' |uniq"], stderr=subprocess.STDOUT).decode("utf8"))
18
  print("prompt: ", prompt)
19
  print("steps: ", steps)
20
+ generator = torch.manual_seed(seed)
21
  start_time = time.time()
22
+ image = pipe(prompt, generator=generator, num_inference_steps=steps, guidance_scale=7.5).images[0]
23
  print("cost: ", time.time() - start_time)
24
  return image
25