gokaygokay commited on
Commit
12a9a98
·
1 Parent(s): eb17cd6

fix output

Browse files
Files changed (1) hide show
  1. app.py +8 -13
app.py CHANGED
@@ -169,20 +169,15 @@ def generate_image(prompt, negative_prompt, width, height, steps, cfg, seed):
169
  vae=get_value_at_index(vaeloader_80, 0),
170
  )
171
 
172
- # Convert tensor to PIL 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
-
177
- # Ensure we have the right shape (height, width, channels)
178
- if len(image_np.shape) == 4: # (batch, channel, height, width)
179
- image_np = image_np[0] # Remove batch dimension
180
- if len(image_np.shape) == 3: # (channel, height, width)
181
- image_np = np.transpose(image_np, (1, 2, 0)) # Convert to (height, width, channel)
182
 
183
- # Convert to PIL Image
184
- image = Image.fromarray(image_np)
185
- return image
186
 
187
  # Create Gradio interface
188
  with gr.Blocks() as app:
 
169
  vae=get_value_at_index(vaeloader_80, 0),
170
  )
171
 
172
+ # Save image using SaveImage node with simple string prefix
173
+ saved = saveimage.save_images(
174
+ filename_prefix="Chroma_Generated",
175
+ images=get_value_at_index(vaedecode_79, 0),
176
+ )
 
 
 
 
 
177
 
178
+ # Return the path to the saved image
179
+ saved_path = f"output/{saved['ui']['images'][0]['filename']}"
180
+ return saved_path
181
 
182
  # Create Gradio interface
183
  with gr.Blocks() as app: