Spaces:
No application file
No application file
Download app.py from rubensaputra/MyModel: direct link, hf CLI and curl.
- Browser
- Download file 438 Bytes
-
https://huggingface.co/spaces/rubensaputra/MyModel/resolve/refs%2Fpr%2F2/app.py
- Command line
-
hf download hf://spaces/rubensaputra/MyModel@refs/pr/2/app.py
-
curl -L -o app.py https://huggingface.co/spaces/rubensaputra/MyModel/resolve/refs%2Fpr%2F2/app.py
438 Bytes
| import gradio as gr | |
| from diffusers import StableDiffusionGLIGENPipeline | |
| import torch | |
| pipe = StableDiffusionGLIGENPipeline.from_pretrained( | |
| "masterful/gligen-1-4-generation-text-box", | |
| torch_dtype=torch.float16 | |
| ).to("cuda" if torch.cuda.is_available() else "cpu") | |
| def generate_image(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| gr.Interface(fn=generate_image, inputs="text", outputs="image").launch() |