Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| "CompVis/stable-diffusion-v1-4", | |
| torch_dtype=torch.float16, | |
| revision="fp16", | |
| safety_checker=None | |
| ).to("cuda") | |
| def generate(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| iface = gr.Interface(fn=generate, inputs="text", outputs="image") | |
| iface.launch() | |