Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,6 @@ import matplotlib.pyplot as plt
|
|
| 8 |
import os, io, base64
|
| 9 |
from PIL import Image
|
| 10 |
from cellpose.io import imread, imsave
|
| 11 |
-
from cellpose.transforms import normalize_img
|
| 12 |
|
| 13 |
# @title Data retrieval
|
| 14 |
def download_weights():
|
|
@@ -224,7 +223,7 @@ def download_function():
|
|
| 224 |
|
| 225 |
def upload_file(filepath):
|
| 226 |
img = imread(filepath)
|
| 227 |
-
img =
|
| 228 |
img = np.clip(img, 0, 1)
|
| 229 |
|
| 230 |
return img
|
|
@@ -241,11 +240,11 @@ with gr.Blocks(title = "Hello",
|
|
| 241 |
input_image = gr.Image(label = "Input image", type = "numpy")
|
| 242 |
|
| 243 |
with gr.Row():
|
| 244 |
-
with gr.Column():
|
| 245 |
up_btn = gr.UploadButton("Upload (png, jpg, tif etc)", visible=True, file_count = "single")
|
| 246 |
resize = gr.Number(label = 'max resize', value = 1000)
|
| 247 |
|
| 248 |
-
with gr.Column():
|
| 249 |
send_btn = gr.Button("Run Cellpose-SAM")
|
| 250 |
down_btn = gr.DownloadButton("Download masks (TIF)", visible=False)
|
| 251 |
down_btn2 = gr.DownloadButton("Download outlines (PNG)", visible=False)
|
|
|
|
| 8 |
import os, io, base64
|
| 9 |
from PIL import Image
|
| 10 |
from cellpose.io import imread, imsave
|
|
|
|
| 11 |
|
| 12 |
# @title Data retrieval
|
| 13 |
def download_weights():
|
|
|
|
| 223 |
|
| 224 |
def upload_file(filepath):
|
| 225 |
img = imread(filepath)
|
| 226 |
+
img = normalize99(img)
|
| 227 |
img = np.clip(img, 0, 1)
|
| 228 |
|
| 229 |
return img
|
|
|
|
| 240 |
input_image = gr.Image(label = "Input image", type = "numpy")
|
| 241 |
|
| 242 |
with gr.Row():
|
| 243 |
+
with gr.Column(scale=1):
|
| 244 |
up_btn = gr.UploadButton("Upload (png, jpg, tif etc)", visible=True, file_count = "single")
|
| 245 |
resize = gr.Number(label = 'max resize', value = 1000)
|
| 246 |
|
| 247 |
+
with gr.Column(scale=1):
|
| 248 |
send_btn = gr.Button("Run Cellpose-SAM")
|
| 249 |
down_btn = gr.DownloadButton("Download masks (TIF)", visible=False)
|
| 250 |
down_btn2 = gr.DownloadButton("Download outlines (PNG)", visible=False)
|