Spaces:
Sleeping
Sleeping
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| import gradio as gr | |
| model_id = "runwayml/stable-diffusion-v1-5" | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) | |
| def predict(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| demo = gr.Interface(fn=predict, inputs="text", outputs="image") | |
| demo.launch() | |