svjack commited on
Commit
f6e691a
·
verified ·
1 Parent(s): d64bbca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -56,7 +56,7 @@ def process_image(img):
56
  # 将 mask 转换为 PIL 图像(使用对应颜色的 RGB 值)
57
  mask_images = []
58
  for i, mask in enumerate(masks):
59
- mask_array = np.zeros((height, width, 3), dtype=np.uint8) # RGB 图像
60
  mask_array[mask] = palette[i] # 使用对应颜色填充
61
  mask_image = Image.fromarray(mask_array, mode='RGB')
62
  mask_images.append(mask_image)
@@ -120,11 +120,9 @@ with gr.Blocks() as demo:
120
  2. Use the brush tool to draw masks with different colors.
121
  3. Click the **Generate Masks** button to create and save the masks.
122
  4. View the generated masks on the right side.
123
-
124
  ## 📂 **Output**
125
  - Each mask is saved as an RGB image in the `output_masks` directory.
126
  - A merged mask is also generated for your convenience.
127
-
128
  ## 🚀 **Enjoy!**
129
  """)
130
 
 
56
  # 将 mask 转换为 PIL 图像(使用对应颜色的 RGB 值)
57
  mask_images = []
58
  for i, mask in enumerate(masks):
59
+ mask_array = np.ones((height, width, 3), dtype=np.uint8) * 255 # 白色背景
60
  mask_array[mask] = palette[i] # 使用对应颜色填充
61
  mask_image = Image.fromarray(mask_array, mode='RGB')
62
  mask_images.append(mask_image)
 
120
  2. Use the brush tool to draw masks with different colors.
121
  3. Click the **Generate Masks** button to create and save the masks.
122
  4. View the generated masks on the right side.
 
123
  ## 📂 **Output**
124
  - Each mask is saved as an RGB image in the `output_masks` directory.
125
  - A merged mask is also generated for your convenience.
 
126
  ## 🚀 **Enjoy!**
127
  """)
128