Spaces:
Sleeping
Sleeping
Download app.py from trush97/AppMakingImageGenerator: direct link, hf CLI and curl.
- Browser
- Download file 493 Bytes
-
https://huggingface.co/spaces/trush97/AppMakingImageGenerator/resolve/main/app.py
- Command line
-
hf download hf://spaces/trush97/AppMakingImageGenerator/app.py
-
curl -L -o app.py https://huggingface.co/spaces/trush97/AppMakingImageGenerator/resolve/main/app.py
493 Bytes
| import gradio as gr | |
| from diffusers import DiffusionPipeline | |
| import torch | |
| pipe = DiffusionPipeline.from_pretrained( | |
| "segmind/tiny-sd", | |
| torch_dtype=torch.float32 | |
| ) | |
| pipe = pipe.to("cpu") | |
| def generate_image(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| demo = gr.Interface( | |
| fn=generate_image, | |
| inputs=gr.Textbox(label="Enter Prompt"), | |
| outputs=gr.Image(label="Generated Image"), | |
| title="Tiny Stable Diffusion Demo" | |
| ) | |
| demo.launch() |