| from diffusers import StableDiffusionPipeline | |
| import torch | |
| # Load the model from Hugging Face repo | |
| pipeline = StableDiffusionPipeline.from_pretrained("Malik99999/MyModel") | |
| pipeline.to("cuda" if torch.cuda.is_available() else "cpu") | |
| # Generate an image from a prompt | |
| prompt = "A beautiful landscape at sunset" | |
| image = pipeline(prompt).images[0] | |
| # Save the generated image | |
| image.save("generated_image.png") | |