Untitled

From Bitty Plover, 5 Months ago, written in Plain Text, viewed 2 times.
URL https://paste.blessuren.de/view/d92c6925 Embed
Download Paste or View Raw
  1. import sys
  2. from diffusers import StableDiffusionXLPipeline
  3. import torch
  4.  
  5. # Command-line args
  6. prompt = sys.argv[1] if len(sys.argv) > 1 else "a futuristic city at sunset"
  7. filename = sys.argv[2] if len(sys.argv) > 2 else "output.png"
  8.  
  9. # Load model
  10. pipe = StableDiffusionXLPipeline.from_pretrained(
  11.     "stabilityai/sdxl-turbo",
  12.     torch_dtype=torch.float16,
  13.     variant="fp16"
  14. ).to("mps")  # Use Apple Metal backend
  15.  
  16. pipe.set_progress_bar_config(disable=False)
  17.  
  18. # Generate image
  19. image = pipe(prompt=prompt, guidance_scale=0.0, num_inference_steps=4).images[0]
  20. image.save(filename)
  21. print(f"Saved image to {filename}")

Reply to "Untitled"

Here you can reply to the paste above