import gradio as gr import torch from diffusers import DiffusionPipeline # from diffusers import StableDiffusionPipeline def generate(prompt): pipeline = DiffusionPipeline.from_pretrained("Lykon/DreamShaper") pipeline.to("cuda") return pipeline(prompt).images[0] iface = gr.Interface(fn=generate, inputs="text", outputs="image") iface.launch()