Update app.py
Browse files
app.py
CHANGED
|
@@ -242,7 +242,7 @@ def download_function():
|
|
| 242 |
b2 = gr.DownloadButton("Download outline image as PNG", visible=False)
|
| 243 |
return b1, b2
|
| 244 |
|
| 245 |
-
def
|
| 246 |
#img = imread(filepath)
|
| 247 |
#img = normalize99(img)
|
| 248 |
#img = np.clip(img, 0, 1)
|
|
@@ -257,7 +257,7 @@ def upload_file(filepath):
|
|
| 257 |
return filepath[-1] #, b1, b2
|
| 258 |
|
| 259 |
|
| 260 |
-
def
|
| 261 |
#img = imread(filepath)
|
| 262 |
#img = normalize99(img)
|
| 263 |
#img = np.clip(img, 0, 1)
|
|
@@ -306,10 +306,10 @@ with gr.Blocks(title = "Hello",
|
|
| 306 |
sample_list = []
|
| 307 |
for j in range(23):
|
| 308 |
sample_list.append("samples/img%0.2d.png"%j)
|
| 309 |
-
gr.Examples(sample_list, inputs=input_image, examples_per_page=25, label = "Click on an example to try it")
|
| 310 |
|
| 311 |
-
input_image.upload(
|
| 312 |
-
up_btn.upload(
|
| 313 |
send_btn.click(cellpose_segment, [up_btn, resize], [img_outlines, flows, down_btn, down_btn2])
|
| 314 |
|
| 315 |
#down_btn.click(download_function, None, [down_btn, down_btn2])
|
|
|
|
| 242 |
b2 = gr.DownloadButton("Download outline image as PNG", visible=False)
|
| 243 |
return b1, b2
|
| 244 |
|
| 245 |
+
def update_image(filepath):
|
| 246 |
#img = imread(filepath)
|
| 247 |
#img = normalize99(img)
|
| 248 |
#img = np.clip(img, 0, 1)
|
|
|
|
| 257 |
return filepath[-1] #, b1, b2
|
| 258 |
|
| 259 |
|
| 260 |
+
def update_button(filepath):
|
| 261 |
#img = imread(filepath)
|
| 262 |
#img = normalize99(img)
|
| 263 |
#img = np.clip(img, 0, 1)
|
|
|
|
| 306 |
sample_list = []
|
| 307 |
for j in range(23):
|
| 308 |
sample_list.append("samples/img%0.2d.png"%j)
|
| 309 |
+
gr.Examples(sample_list, fn = update_button, inputs=input_image, outputs = up_btn, examples_per_page=25, label = "Click on an example to try it")
|
| 310 |
|
| 311 |
+
input_image.upload(update_button, input_image, up_btn)
|
| 312 |
+
up_btn.upload(update_image, up_btn, input_image)
|
| 313 |
send_btn.click(cellpose_segment, [up_btn, resize], [img_outlines, flows, down_btn, down_btn2])
|
| 314 |
|
| 315 |
#down_btn.click(download_function, None, [down_btn, down_btn2])
|