madebyollin commited on
Commit
2bd029b
1 Parent(s): 476f0d5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +21 -0
README.md CHANGED
@@ -8,3 +8,24 @@ license: mit
8
  `taesd-x4-upscaler` is useful for [real-time previewing](https://twitter.com/madebyollin/status/1679356448655163394) of the upsampling process.
9
 
10
  This repo contains `.safetensors` versions of the `taesd-x4-upscaler` weights.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  `taesd-x4-upscaler` is useful for [real-time previewing](https://twitter.com/madebyollin/status/1679356448655163394) of the upsampling process.
9
 
10
  This repo contains `.safetensors` versions of the `taesd-x4-upscaler` weights.
11
+
12
+ ## Using in 🧨 diffusers
13
+
14
+ ```python
15
+ import requests
16
+ from PIL import Image
17
+ from io import BytesIO
18
+
19
+ url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/sd2-upscale/low_res_cat.png"
20
+ low_res_img = Image.open(BytesIO(requests.get(url).content)).convert("RGB").resize((128, 128))
21
+
22
+ import torch
23
+ from diffusers import StableDiffusionUpscalePipeline, AutoencoderTiny
24
+
25
+ pipe = StableDiffusionUpscalePipeline.from_pretrained("stabilityai/stable-diffusion-x4-upscaler", torch_dtype=torch.float16)
26
+ pipe.vae = AutoencoderTiny.from_pretrained("madebyollin/taesd-x4-upscaler", torch_dtype=torch.float16)
27
+ pipe = pipe.to("cuda")
28
+
29
+ image = pipe("a white cat", image=low_res_img, num_inference_steps=25).images[0]
30
+ image.save("upsampled.png")
31
+ ```