Spaces:
Running
on
Zero
Running
on
Zero
Update app_3.py
Browse files
app_3.py
CHANGED
@@ -1501,7 +1501,7 @@ def process_image(input_image, input_text):
|
|
1501 |
|
1502 |
# Create RGBA image with default 255 alpha
|
1503 |
alpha = np.zeros((H, W, 1), dtype=np.uint8)
|
1504 |
-
alpha[~first_mask] =
|
1505 |
alpha[first_mask] = 255 # Make the foreground opaque
|
1506 |
alpha = alpha.squeeze(-1) # Remove singleton dimension to become 2D
|
1507 |
rgba = np.dstack((img, alpha)).astype(np.uint8)
|
|
|
1501 |
|
1502 |
# Create RGBA image with default 255 alpha
|
1503 |
alpha = np.zeros((H, W, 1), dtype=np.uint8)
|
1504 |
+
alpha[~first_mask] = 0 # 128 for semi-transparency background
|
1505 |
alpha[first_mask] = 255 # Make the foreground opaque
|
1506 |
alpha = alpha.squeeze(-1) # Remove singleton dimension to become 2D
|
1507 |
rgba = np.dstack((img, alpha)).astype(np.uint8)
|