File size: 1,026 Bytes
b795ca9 ef6b7af b795ca9 daaf23e ef6b7af daaf23e ef6b7af ace7d89 e567b02 ef6b7af ace7d89 cf17627 ef6b7af b795ca9 d4e1921 ef6b7af d4e1921 4fd141b d4e1921 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
import requests
import torch
from PIL import Image
from io import BytesIO
import time
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained("/home/patrick_huggingface_co/stable-diffusion-2-1-unclip-i2i-l", torch_dtype=torch.float16)
pipe.to("cuda")
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(13).png"
#url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(10).png"
#url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(10).png"
#url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/image%20(10).png"
response = requests.get(url)
init_image = Image.open(BytesIO(response.content)).convert("RGB")
# init_image = init_image.resize((768, 512))
images = pipe(4 * [init_image]).images
for i in range(len(images)):
images[i].save(f"fantasy_landscape_{i}.png")
|