from diffusers import StableDiffusionPipeline as SD import torch import gradio as gr model_id = "runwayml/stable-diffusion-v1-5" gen = SD.from_pretrained(model_id) gen.to("cuda") def generate(): prompt = "A doggo" image = gen(prompt).images[0] image.save("result.png")