Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
3b546bc
1
Parent(s):
3fd4792
fix output
Browse files
app.py
CHANGED
@@ -173,6 +173,8 @@ def generate_image(prompt, negative_prompt, width, height, steps, cfg, seed):
|
|
173 |
image_tensor = get_value_at_index(vaedecode_79, 0)
|
174 |
# Convert from [0,1] to [0,255] range and ensure it's in the right format
|
175 |
image_np = (image_tensor.cpu().numpy() * 255).astype(np.uint8)
|
|
|
|
|
176 |
# Convert to PIL Image
|
177 |
image = Image.fromarray(image_np)
|
178 |
return image
|
|
|
173 |
image_tensor = get_value_at_index(vaedecode_79, 0)
|
174 |
# Convert from [0,1] to [0,255] range and ensure it's in the right format
|
175 |
image_np = (image_tensor.cpu().numpy() * 255).astype(np.uint8)
|
176 |
+
# Reshape from (batch, channel, height, width) to (height, width, channel)
|
177 |
+
image_np = np.transpose(image_np[0], (1, 2, 0))
|
178 |
# Convert to PIL Image
|
179 |
image = Image.fromarray(image_np)
|
180 |
return image
|