jbilcke-hf HF staff commited on
Commit
3b58a26
·
verified ·
1 Parent(s): dc16672

Update gradio_app.py

Browse files
Files changed (1) hide show
  1. gradio_app.py +5 -3
gradio_app.py CHANGED
@@ -190,11 +190,13 @@ def generate_and_process_3d(prompt: str, seed: int = 42, width: int = 1024, heig
190
  rgb_image = generated_image.convert('RGB')
191
 
192
  print("[debug] removing the background by calling bg_remover.process(rgb_image)")
193
- # The key change: Process returns RGBA with transparent background
194
  no_bg_image = bg_remover.process(rgb_image)
 
195
 
196
- # Convert the no_bg_image directly to RGBA (it should already be RGBA)
197
- rgba_image = Image.fromarray(no_bg_image).convert('RGBA')
 
198
 
199
  print("[debug] auto-cropping the rgba_image using spar3d_utils.foreground_crop(...)")
200
  processed_image = spar3d_utils.foreground_crop(
 
190
  rgb_image = generated_image.convert('RGB')
191
 
192
  print("[debug] removing the background by calling bg_remover.process(rgb_image)")
193
+ # bg_remover returns a PIL Image already, no need to convert
194
  no_bg_image = bg_remover.process(rgb_image)
195
+ print(f"[debug] no_bg_image type: {type(no_bg_image)}, mode: {no_bg_image.mode}")
196
 
197
+ # Convert to RGBA if not already
198
+ rgba_image = no_bg_image.convert('RGBA')
199
+ print(f"[debug] rgba_image mode: {rgba_image.mode}")
200
 
201
  print("[debug] auto-cropping the rgba_image using spar3d_utils.foreground_crop(...)")
202
  processed_image = spar3d_utils.foreground_crop(