Downloads · 30 days
0
asif1437/ai
ai is a machine learning model from asif1437. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
import torch from diffusers import StableDiffusionPipeline
Downloads · 30 days
0
Access
Public
Updated Sep 23, 2024
Repo size
—
Likes
0
Public
Click a slice to open those files.
Other1.5 KB · 74%
From the Hugging Face model README
import torch from diffusers import StableDiffusionPipeline
model_id = "runwayml/stable-diffusion-v1-5" pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16) pipe = pipe.to("cuda") def generate_image(prompt): with torch.no_grad(): image = pipe(prompt).images[0] return image
prompt = "A fantasy landscape with mountains and a sunset" image = generate_image(prompt)
image.save("generated_image.png")