Download app.py from Bagda/EDR: direct link, hf CLI and curl.
- Browser
- Download file 1.02 kB
-
https://huggingface.co/spaces/Bagda/EDR/resolve/main/app.py
- Command line
-
hf download hf://spaces/Bagda/EDR/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Bagda/EDR/resolve/main/app.py
1.02 kB
| import gradio as gr | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| # Model load | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| "Linaqruf/anything-v3.0", | |
| torch_dtype=torch.float16, | |
| revision="fp16", | |
| safety_checker=None | |
| ).to("cuda" if torch.cuda.is_available() else "cpu") | |
| def generate_thumbnail(prompt): | |
| image = pipe(prompt, height=512, width=512).images[0] | |
| return image | |
| # Gradio UI | |
| iface = gr.Interface( | |
| fn=generate_thumbnail, | |
| inputs=gr.Textbox(label="Thumbnail Prompt"), | |
| outputs=gr.Image(label="Generated Thumbnail"), | |
| title="Anime Thumbnail Generator", | |
| description="Generate thumbnails using Linaqruf/anything-v3.0 model" | |
| ) | |
| iface.launch() | |
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| pipe = StableDiffusionPipeline.from_pretrained( | |
| "Linaqruf/anything-v3.0", | |
| torch_dtype=torch.float16, # ✅ यह सही है | |
| use_auth_token=True # या HF_TOKEN अगर Space में चला रहे हो | |
| ).to("cuda") | |