patrickvonplaten commited on
Commit
638a3b4
1 Parent(s): ace7d89
Files changed (2) hide show
  1. run.py +6 -13
  2. 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("/home/patrick_huggingface_co/stable-diffusion-2-1-unclip-i2i-l", torch_dtype=torch.float16)
10
  pipe.to("cuda")
11
 
12
- url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(13).png"
13
- #url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(10).png"
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
- init_image = Image.open(BytesIO(response.content)).convert("RGB")
19
- # init_image = init_image.resize((768, 512))
20
-
21
- images = pipe(4 * [init_image]).images
22
 
23
- for i in range(len(images)):
24
- images[i].save(f"fantasy_landscape_{i}.png")
 
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

  • SHA256: 11ac814bdd78c9349d916558a0189e415f3b136201f467c7105d405e772db23c
  • Pointer size: 131 Bytes
  • Size of remote file: 807 kB