patrickvonplaten
commited on
Commit
•
638a3b4
1
Parent(s):
ace7d89
up
Browse files- run.py +6 -13
- tarsila_variation.png +3 -0
run.py
CHANGED
@@ -2,23 +2,16 @@ import requests
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
5 |
-
import time
|
6 |
|
7 |
from diffusers import DiffusionPipeline
|
8 |
|
9 |
-
pipe = DiffusionPipeline.from_pretrained("/
|
10 |
pipe.to("cuda")
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
#url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(10).png"
|
15 |
-
#url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(10).png"
|
16 |
-
|
17 |
response = requests.get(url)
|
18 |
-
|
19 |
-
# init_image = init_image.resize((768, 512))
|
20 |
-
|
21 |
-
images = pipe(4 * [init_image]).images
|
22 |
|
23 |
-
|
24 |
-
|
|
|
2 |
import torch
|
3 |
from PIL import Image
|
4 |
from io import BytesIO
|
|
|
5 |
|
6 |
from diffusers import DiffusionPipeline
|
7 |
|
8 |
+
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-unclip", torch_dtype=torch.float16, variant="fp16")
|
9 |
pipe.to("cuda")
|
10 |
|
11 |
+
# get image
|
12 |
+
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/tarsila_do_amaral.png"
|
|
|
|
|
|
|
13 |
response = requests.get(url)
|
14 |
+
image = Image.open(BytesIO(response.content)).convert("RGB")
|
|
|
|
|
|
|
15 |
|
16 |
+
image = pipe(image).images[0]
|
17 |
+
image.save(f"tarsila_variation.png")
|
tarsila_variation.png
ADDED
Git LFS Details
|