Skip to content

Instantly share code, notes, and snippets.

@AlexeyLugovoy
Last active June 10, 2024 19:52
Show Gist options
  • Save AlexeyLugovoy/e88dbded2e89ccfe20431fbaf3ad716f to your computer and use it in GitHub Desktop.
Save AlexeyLugovoy/e88dbded2e89ccfe20431fbaf3ad716f to your computer and use it in GitHub Desktop.
from diffusers import AutoPipelineForImage2Image
CACHE_DIR = "."
DEVICE = "cuda:0"
pipe = AutoPipelineForImage2Image.from_pretrained(
"runwayml/stable-diffusion-v1-5",
torch_dtype=torch.float16,
variant="fp16",
use_safetensors=True,
cache_dir=CACHE_DIR
).to(DEVICE)
prompt = "New modern style of livingroom, warm color palette, detailed, 8k"
img_gen = pipe(prompt, image=img_pil.resize((512, 512)), strenght=0.7, num_inference_steps=100)
img_gen.images[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment