File size: 556 Bytes
b795ca9 ef6b7af b795ca9 ef6b7af daaf23e ef6b7af 638a3b4 e567b02 ef6b7af 638a3b4 b795ca9 638a3b4 d4e1921 638a3b4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import requests
import torch
from PIL import Image
from io import BytesIO
from diffusers import DiffusionPipeline
pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-2-1-unclip", torch_dtype=torch.float16, variant="fp16")
pipe.to("cuda")
# get image
url = "https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/stable_unclip/tarsila_do_amaral.png"
response = requests.get(url)
image = Image.open(BytesIO(response.content)).convert("RGB")
image = pipe(image).images[0]
image.save(f"tarsila_variation.png")
|