Spaces:
Configuration error
Configuration error
Download app.py from mcgi/dragon-back: direct link, hf CLI and curl.
- Browser
- Download file 637 Bytes
-
https://huggingface.co/spaces/mcgi/dragon-back/resolve/main/app.py
- Command line
-
hf download hf://spaces/mcgi/dragon-back/app.py
-
curl -L -o app.py https://huggingface.co/spaces/mcgi/dragon-back/resolve/main/app.py
637 Bytes
| from diffusers import StableDiffusionPipeline | |
| import torch | |
| def main(): | |
| model_id = "CompVis/stable-diffusion-v1-4" | |
| print("در حال بارگذاری مدل...") | |
| pipe = StableDiffusionPipeline.from_pretrained(model_id) | |
| # استفاده از CPU | |
| pipe = pipe.to("cpu") | |
| prompt = "A beautiful landscape, high quality, detailed" | |
| print(f"در حال تولید تصویر با متن: {prompt}") | |
| image = pipe(prompt).images[0] | |
| output_path = "output.png" | |
| image.save(output_path) | |
| print(f"تصویر با موفقیت ذخیره شد: {output_path}") | |
| if __name__ == "__main__": | |
| main() |