Update README.md
#2
by
patrickvonplaten
- opened
README.md
CHANGED
@@ -43,15 +43,23 @@ pip install git+https://github.com/diffusers.git transformers accelerate scipy s
|
|
43 |
Running the pipeline (if you don't swap the scheduler it will run with the default DDIM, in this example we are swapping it to DPMSolverMultistepScheduler):
|
44 |
|
45 |
```python
|
|
|
46 |
import torch
|
47 |
-
from
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
```
|
56 |
|
57 |
# Uses
|
|
|
43 |
Running the pipeline (if you don't swap the scheduler it will run with the default DDIM, in this example we are swapping it to DPMSolverMultistepScheduler):
|
44 |
|
45 |
```python
|
46 |
+
import requests
|
47 |
import torch
|
48 |
+
from PIL import Image
|
49 |
+
from io import BytesIO
|
50 |
+
|
51 |
+
from diffusers import DiffusionPipeline
|
52 |
+
|
53 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-unclip", torch_dtype=torch.float16, variant="fp16")
|
54 |
+
pipe.to("cuda")
|
55 |
+
|
56 |
+
# get image
|
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 |
+
image = Image.open(BytesIO(response.content)).convert("RGB")
|
60 |
+
|
61 |
+
# run image variation
|
62 |
+
image = pipe(image).images[0]
|
63 |
```
|
64 |
|
65 |
# Uses
|