Spaces:
Runtime error
Runtime error
Download app.py from nyrt/docker_python: direct link, hf CLI and curl.
- Browser
- Download file 426 Bytes
-
https://huggingface.co/spaces/nyrt/docker_python/resolve/main/app.py
- Command line
-
hf download hf://spaces/nyrt/docker_python/app.py
-
curl -L -o app.py https://huggingface.co/spaces/nyrt/docker_python/resolve/main/app.py
426 Bytes
| print("Start") | |
| import torch | |
| from diffusers import StableDiffusionPipeline | |
| model_id = "CompVis/stable-diffusion-v1-4" | |
| device = "cuda" | |
| print("Init Pipeline") | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) | |
| print("Add device to pipeline") | |
| pipe = pipe.to(device) | |
| prompt = "a photo of an astronaut riding a horse on mars" | |
| print("Generating image") | |
| image = pipe(prompt).images[0] | |
| print("Done") |