Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| model_id = "runwayml/stable-diffusion-v1-5" | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id) | |
| pipe = pipe.to("cuda" if torch.cuda.is_available() else "cpu") | |
| def generate(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| iface = gr.Interface(fn=generate, inputs="text", outputs="image") | |
| iface.launch() |