Spaces:
Runtime error
Runtime error
Download app.py from cosmicaether/Diffusion_Correct: direct link, hf CLI and curl.
- Browser
- Download file 713 Bytes
-
https://huggingface.co/spaces/cosmicaether/Diffusion_Correct/resolve/main/app.py
- Command line
-
hf download hf://spaces/cosmicaether/Diffusion_Correct/app.py
-
curl -L -o app.py https://huggingface.co/spaces/cosmicaether/Diffusion_Correct/resolve/main/app.py
713 Bytes
| import gradio as gr | |
| import torch | |
| from diffusers import StableDiffusionPipeline, EulerAncestralDiscreteScheduler | |
| device = "cuda" if torch.cuda.is_available() else "cpu" | |
| dtype = torch.float16 if device == "cuda" else torch.float32 | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| "Linaqruf/anything-v3.0", | |
| torch_dtype=dtype | |
| ) | |
| pipe.scheduler = EulerAncestralDiscreteScheduler.from_config( | |
| pipe.scheduler.config | |
| ) | |
| pipe = pipe.to(device) | |
| def generate(prompt): | |
| image = pipe(prompt, num_inference_steps=25).images[0] | |
| return image | |
| demo = gr.Interface( | |
| fn=generate, | |
| inputs=gr.Textbox(label="Prompt"), | |
| outputs=gr.Image(), | |
| title="Euler Ancestral Stable Diffusion", | |
| ) | |
| demo.launch() | |