tools / run_local.py
patrickvonplaten's picture
add local run script
69f6fc2
raw
history blame
489 Bytes
#!/usr/bin/env python3
from diffusers import DiffusionPipeline
import torch
import os
import sys
local_path = sys.argv[1]
local_path = os.path.abspath(local_path)
prompts = ["astronaut on mars", "Barack Obama smiling with a big grin"]
pipe = DiffusionPipeline.from_pretrained(local_path, torch_dtype=torch.float16)
pipe = pipe.to("cuda")
for prompt in prompts:
image = pipe(prompt).images[0]
image.save(f"/home/patrick_huggingface_co/images/a_{'_'.join(prompt.split())}.png")