Update the demo code without the post-processing steps and with the new API

#1
by multimodalart HF staff - opened
Files changed (1) hide show
  1. README.md +3 -11
README.md CHANGED
@@ -19,25 +19,17 @@ tags:
19
  ```python
20
  # !pip install diffusers
21
  from diffusers import DiffusionPipeline
22
- import PIL.Image
23
- import numpy as np
24
 
25
- model_id = "google/ddpm-celeba-hq"
26
 
27
  # load model and scheduler
28
  ddpm = DiffusionPipeline.from_pretrained(model_id)
29
 
30
  # run pipeline in inference (sample random noise and denoise)
31
- image = ddpm()
32
-
33
- # process image to PIL
34
- image_processed = image.cpu().permute(0, 2, 3, 1)
35
- image_processed = (image_processed + 1.0) * 127.5
36
- image_processed = image_processed.numpy().astype(np.uint8)
37
- image_pil = PIL.Image.fromarray(image_processed[0])
38
 
39
  # save image
40
- image_pil.save("test.png")
41
  ```
42
 
43
  ## Samples
 
19
  ```python
20
  # !pip install diffusers
21
  from diffusers import DiffusionPipeline
 
 
22
 
23
+ model_id = "google/ddpm-celebahq-256"
24
 
25
  # load model and scheduler
26
  ddpm = DiffusionPipeline.from_pretrained(model_id)
27
 
28
  # run pipeline in inference (sample random noise and denoise)
29
+ images = ddpm()["sample"]
 
 
 
 
 
 
30
 
31
  # save image
32
+ images[0].save("ddpm_generated_image.png")
33
  ```
34
 
35
  ## Samples