File size: 417 Bytes
9ecc7bb
2e463bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import os
import torch
from diffusers import StableDiffusion3Pipeline

pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3-medium-diffusers",token=os.environ["HF_TOKEN"], torch_dtype=torch.float16)
pipe = pipe.to("cuda")


def generate_image(prompt):
    image = pipe(
    prompt,
    negative_prompt="",
    num_inference_steps=28,
    guidance_scale=7.0,
    ).images[0]
    return image