Commit
·
45d3d7a
1
Parent(s):
c4d145c
Update README.md (#2)
Browse files- Update README.md (cb4b5bcd5d2b43ae206ca5c3f633d89fc2277cc6)
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
|