File size: 403 Bytes
1f53af1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 | import gradio as gr
from diffusers import StableDiffusionPipeline
import torch
pipe = StableDiffusionPipeline.from_pretrained(
"Lykon/dreamshaper-8", torch_dtype=torch.float16
).to("cuda" if torch.cuda.is_available() else "cpu")
def generate(prompt):
image = pipe(prompt).images[0]
return image
gr.Interface(fn=generate, inputs="text", outputs="image", title="Nyra AI Generator").launch() |