Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 |
-
|
| 60 |
-
|
| 61 |
-
|
| 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 |
|