opsiclear-admin commited on
Commit
33e26d4
·
verified ·
1 Parent(s): 7814973

Upload app.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -336,9 +336,7 @@ def remove_background(input: Image.Image) -> Image.Image:
336
  output = Image.open(output)
337
  return output
338
  except Exception as e:
339
- print(f"[WARNING] Background removal failed: {e}. Using image as-is.")
340
- # Return original image with a full-white alpha channel
341
- return input.convert('RGBA')
342
 
343
 
344
  def preprocess_image(input: Image.Image) -> Image.Image:
 
336
  output = Image.open(output)
337
  return output
338
  except Exception as e:
339
+ raise gr.Error(f"Background removal failed: {e}. Please upload images with transparent backgrounds (RGBA), or try again later.")
 
 
340
 
341
 
342
  def preprocess_image(input: Image.Image) -> Image.Image: