File size: 482 Bytes
f0aa6da
 
 
 
712dadd
da36c34
f0aa6da
 
 
 
 
 
85da16d
da36c34
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from diffusers import DiffusionPipeline
import torch
import gradio as gr

pipe = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", torch_dtype=torch.float32, use_safetensors=True, variant="fp16")
pipe.to("cpu")  # Note the change here

def generate_image(prompt):
    images = pipe(prompt='an highly detailed , highly realistic'+prompt).images[0]
    return images

iface = gr.Interface(fn=generate_image, inputs="text", outputs="image")
iface.launch()