Commit
•
efbe56c
1
Parent(s):
45d3d7a
Update README.md
Browse files
README.md
CHANGED
@@ -35,7 +35,7 @@ This `stable-diffusion-2-1-unclip` is a finetuned version of Stable Diffusion 2.
|
|
35 |
|
36 |
## Examples
|
37 |
|
38 |
-
Using the [🤗's Diffusers library](https://github.com/huggingface/diffusers) to run Stable Diffusion
|
39 |
|
40 |
```bash
|
41 |
pip install git+https://github.com/diffusers.git transformers accelerate scipy safetensors
|
@@ -48,19 +48,24 @@ import torch
|
|
48 |
from PIL import Image
|
49 |
from io import BytesIO
|
50 |
|
51 |
-
from diffusers import
|
52 |
|
53 |
-
|
54 |
-
pipe.
|
|
|
|
|
|
|
55 |
|
56 |
-
#
|
57 |
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/tarsila_do_amaral.png"
|
58 |
response = requests.get(url)
|
59 |
-
|
60 |
|
61 |
-
#
|
62 |
-
|
|
|
63 |
```
|
|
|
64 |
|
65 |
# Uses
|
66 |
|
|
|
35 |
|
36 |
## Examples
|
37 |
|
38 |
+
Using the [🤗's Diffusers library](https://github.com/huggingface/diffusers) to run Stable Diffusion v2-1 UnCLIP in a simple and efficient manner.
|
39 |
|
40 |
```bash
|
41 |
pip install git+https://github.com/diffusers.git transformers accelerate scipy safetensors
|
|
|
48 |
from PIL import Image
|
49 |
from io import BytesIO
|
50 |
|
51 |
+
from diffusers import StableUnCLIPImg2ImgPipeline
|
52 |
|
53 |
+
#Start the StableUnCLIP Image variations pipeline
|
54 |
+
pipe = StableUnCLIPImg2ImgPipeline.from_pretrained(
|
55 |
+
"stabilityai/stable-diffusion-2-1-unclip", torch_dtype=torch.float16, variation="fp16"
|
56 |
+
)
|
57 |
+
pipe = pipe.to("cuda")
|
58 |
|
59 |
+
#Get image from URL
|
60 |
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/tarsila_do_amaral.png"
|
61 |
response = requests.get(url)
|
62 |
+
init_image = Image.open(BytesIO(response.content)).convert("RGB")
|
63 |
|
64 |
+
#Pipe to make the variation
|
65 |
+
images = pipe(init_image).images
|
66 |
+
images[0].save("tarsila_variation.png")
|
67 |
```
|
68 |
+
Check out the [Stable UnCLIP pipeline docs here](https://huggingface.co/docs/diffusers/main/en/api/pipelines/stable_unclip)
|
69 |
|
70 |
# Uses
|
71 |
|