pranavajay
commited on
Create test.py
Browse files
test.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import torch
|
2 |
+
from diffusers import FluxPipeline
|
3 |
+
|
4 |
+
# Specify the path to your merged model
|
5 |
+
model_path = "output_checkpoint.safetensors" # Replace with the actual path
|
6 |
+
|
7 |
+
# Load the merged model
|
8 |
+
pipeline = FluxPipeline.from_pretrained(model_path, torch_dtype=torch.float16) # Use float32 if you don't have a GPU
|
9 |
+
|
10 |
+
# Set the model to evaluation mode
|
11 |
+
pipeline.eval()
|
12 |
+
|
13 |
+
# Example: Generating an image with a prompt
|
14 |
+
prompt = "A serene landscape with mountains and a lake" # Customize your prompt here
|
15 |
+
image = pipeline(prompt).images[0]
|
16 |
+
|
17 |
+
# Save or display the generated image
|
18 |
+
image.save("generated_image.png")
|