Import torch from diffusers import StableDiffusionPipeline
![import torch
from diffusers import StableDiffusionPipeline
# Load the model
model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda" if torch.cuda.is_available() else "cpu"
pipe = StableDiffusionPipeline.from_pretrained(model_id)
pipe.to(device)
# Define the prompt
prompt = "A black cat with a dark background, standing on two legs, hanging an AK-47 rifle gun on its front, wearing a golden necklace"
# Generate the image
image = pipe(prompt).images[0]
# Save the image
image.save("generated_black_cat.png")
print("Image generated and saved as 'generated_black_cat.png'")](https://image.cdn2.seaart.me/2024-06-21/cpqgqf5e878c73cui1bg/c0032d6d3a4eab45ba7af57b3af79b05fa1e9a8e_high.webp)

import torch from diffusers import StableDiffusionPipeline # Load the model model_id = "CompVis/stable-diffusion-v1-4" device = "cuda" if torch.cuda.is_available() else "cpu" pipe = StableDiffusionPipeline.from_pretrained(model_id) pipe.to(device) # Define the prompt prompt = "A black cat with a dark background, standing on two legs, hanging an AK-47 rifle gun on its front, wearing a golden necklace" # Generate the image image = pipe(prompt).images[0] # Save the image image.save("generated_black_cat.png") print("Image generated and saved as 'generated_black_cat.png'")
提示詞
復製
import torch
from diffusers import StableDiffusionPipeline
# Load the model
model_id = "CompVis/stable-diffusion-v1-4"
device = "cuda" if torch
.
cuda
.
is_available() else "cpu"
pipe = StableDiffusionPipeline
.
from_pretrained(model_id)
pipe
.
to(device)
# Define the prompt
prompt = "A black cat with a dark background
,
standing on two legs
,
hanging an AK-47 rifle gun on its front
,
wearing a golden necklace"
# Generate the image
image = pipe(prompt)
.
images[0]
# Save the image
image
.
save("generated_black_cat
.
png")
print("Image generated and saved as 'generated_black_cat
.
png'")
信息
模型 & 風格

Checkpoint
CyberRealistic
#動物
#史诗角色
#福瑞
共 0 條評論
0
0
0