mouseland commited on
Commit
fd26ead
·
verified ·
1 Parent(s): cb2e681

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -51,6 +51,7 @@ def plot_flows(y):
51
  return flow
52
 
53
  def plot_outlines(img, masks):
 
54
  outpix = []
55
  contours, hierarchy = cv2.findContours(masks.astype(np.int32), mode=cv2.RETR_FLOODFILL, method=cv2.CHAIN_APPROX_SIMPLE)
56
  for c in range(len(contours)):
@@ -263,9 +264,9 @@ with gr.Blocks(title = "Hello",
263
  input_image = gr.Image(label = "Input image", type = "filepath")
264
 
265
  with gr.Row():
266
- with gr.Column(scale=1):
267
- filepath = gr.UploadButton("Upload (png, jpg, tif etc)", visible=True, file_count = "single")
268
- resize = gr.Number(label = 'max resize', value = 1000)
269
 
270
  with gr.Column(scale=1):
271
  send_btn = gr.Button("Run Cellpose-SAM")
@@ -287,7 +288,7 @@ with gr.Blocks(title = "Hello",
287
  sample_list.append("samples/img%0.2d.png"%j)
288
  gr.Examples(sample_list, inputs=input_image, examples_per_page=25)
289
 
290
- input_image.change(update_image, input_image, [input_image, filepath])
291
  #up_btn.upload(upload_file, up_btn, [input_image, up_btn, down_btn, down_btn2])
292
  send_btn.click(cellpose_segment, [filepath, resize], [img_outlines, img_overlay, flows, down_btn, down_btn2])
293
 
 
51
  return flow
52
 
53
  def plot_outlines(img, masks):
54
+ img = normalize99(img)
55
  outpix = []
56
  contours, hierarchy = cv2.findContours(masks.astype(np.int32), mode=cv2.RETR_FLOODFILL, method=cv2.CHAIN_APPROX_SIMPLE)
57
  for c in range(len(contours)):
 
264
  input_image = gr.Image(label = "Input image", type = "filepath")
265
 
266
  with gr.Row():
267
+ #with gr.Column(scale=1):
268
+ #filepath = gr.UploadButton("Upload (png, jpg, tif etc)", visible=True, file_count = "single")
269
+ resize = gr.Number(label = 'max resize', value = 1000)
270
 
271
  with gr.Column(scale=1):
272
  send_btn = gr.Button("Run Cellpose-SAM")
 
288
  sample_list.append("samples/img%0.2d.png"%j)
289
  gr.Examples(sample_list, inputs=input_image, examples_per_page=25)
290
 
291
+ #input_image.change(update_image, input_image, [input_image, filepath])
292
  #up_btn.upload(upload_file, up_btn, [input_image, up_btn, down_btn, down_btn2])
293
  send_btn.click(cellpose_segment, [filepath, resize], [img_outlines, img_overlay, flows, down_btn, down_btn2])
294