Update app.py
Browse files
app.py
CHANGED
|
@@ -150,11 +150,11 @@ def run_segmentation(image, model_choice):
|
|
| 150 |
|
| 151 |
# Process image format to RGB
|
| 152 |
if len(image_np.shape) == 2:
|
| 153 |
-
processed_image_np = cv2.cvtColor(
|
| 154 |
elif len(image_np.shape) == 3 and image_np.shape[2] == 4:
|
| 155 |
processed_image_np = cv2.cvtColor(image_np, cv2.COLOR_RGBA2RGB)
|
| 156 |
else:
|
| 157 |
-
processed_image_np =
|
| 158 |
|
| 159 |
# Run Cellpose segmentation
|
| 160 |
masks, flows, styles = model.eval(processed_image_np, diameter=None, channels=[0, 0])
|
|
@@ -321,7 +321,6 @@ with gr.Blocks(
|
|
| 321 |
1. **Upload and Segment**:
|
| 322 |
- Upload your microscopy image.
|
| 323 |
- Select a Cellpose model (e.g., "Hemocytometer Model" for suspension culture).
|
| 324 |
-
- Draw a selection region using the Image Editor.
|
| 325 |
- Click "Run Segmentation".
|
| 326 |
|
| 327 |
2. **Analysis Results**:
|
|
|
|
| 150 |
|
| 151 |
# Process image format to RGB
|
| 152 |
if len(image_np.shape) == 2:
|
| 153 |
+
processed_image_np = cv2.cvtColor(image_np, cv2.COLOR_GRAY2RGB)
|
| 154 |
elif len(image_np.shape) == 3 and image_np.shape[2] == 4:
|
| 155 |
processed_image_np = cv2.cvtColor(image_np, cv2.COLOR_RGBA2RGB)
|
| 156 |
else:
|
| 157 |
+
processed_image_np = image_np
|
| 158 |
|
| 159 |
# Run Cellpose segmentation
|
| 160 |
masks, flows, styles = model.eval(processed_image_np, diameter=None, channels=[0, 0])
|
|
|
|
| 321 |
1. **Upload and Segment**:
|
| 322 |
- Upload your microscopy image.
|
| 323 |
- Select a Cellpose model (e.g., "Hemocytometer Model" for suspension culture).
|
|
|
|
| 324 |
- Click "Run Segmentation".
|
| 325 |
|
| 326 |
2. **Analysis Results**:
|