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-small", 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")