Original
This commit is contained in:
commit
7e9e55d131
11 changed files with 324 additions and 0 deletions
21
test.py
Normal file
21
test.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
|
||||
import torch
|
||||
from diffusers import StableDiffusionPipeline
|
||||
from PIL import Image
|
||||
|
||||
# Load the model from the local file
|
||||
model_path = "sdxlAni.safetensors"
|
||||
pipe = StableDiffusionPipeline.from_pretrained(model_path, torch_dtype=torch.float16)
|
||||
|
||||
# Move the pipeline to GPU if available
|
||||
if torch.cuda.is_available():
|
||||
pipe = pipe.to("cuda")
|
||||
|
||||
# Generate an image
|
||||
prompt = "A fantasy landscape with mountains and a river"
|
||||
image = pipe(prompt).images[0]
|
||||
|
||||
# Save the generated image
|
||||
image.save("generated_image.png")
|
||||
|
||||
print("Image generated and saved as 'generated_image.png'")
|
Loading…
Add table
Add a link
Reference in a new issue