Spaces:
Sleeping
Sleeping
Download app.py from Scorpsuki/my-diffusion-app: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/spaces/Scorpsuki/my-diffusion-app/resolve/main/app.py
- Command line
-
hf download hf://spaces/Scorpsuki/my-diffusion-app/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Scorpsuki/my-diffusion-app/resolve/main/app.py
400 Bytes
| 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() |