ysharma HF staff commited on
Commit
9522496
β€’
1 Parent(s): 6cddac6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -49,17 +49,14 @@ def remove_background(result):
49
  print(type(result))
50
  # Check if the variable is a PIL Image
51
  if isinstance(result, Image.Image):
52
- print('here IF')
53
  result = rembg.remove(result)
54
  # Check if the variable is a str filepath
55
  elif isinstance(result, str):
56
- print('here ELIF')
57
  result = Image.open(result)
58
  result = rembg.remove(result)
59
- elif isinstance(result, numpy.ndarray):
60
- print('here ELIF 2')
61
- # Convert the NumPy array to a PIL Image
62
- result = Image.fromarray(result)
63
  return result
64
 
65
 
 
49
  print(type(result))
50
  # Check if the variable is a PIL Image
51
  if isinstance(result, Image.Image):
 
52
  result = rembg.remove(result)
53
  # Check if the variable is a str filepath
54
  elif isinstance(result, str):
 
55
  result = Image.open(result)
56
  result = rembg.remove(result)
57
+ else:
58
+ # Convert the NumPy array to a PIL Image
59
+ result = Image.fromarray(result)
 
60
  return result
61
 
62