Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -43,15 +43,17 @@ def predict(img_name, model=None, device=None, reduce_labels=True):
|
|
43 |
my_model.load_checkpoints(checkpoints)
|
44 |
with torch.no_grad():
|
45 |
output = my_model(pre_img_data)
|
|
|
46 |
overlay = visualize_instances_map(pre_img_data,output)
|
|
|
47 |
#cv2.imwrite('prediction.png', cv2.cvtColor(overlay, cv2.COLOR_RGB2BGR))
|
48 |
-
return overlay
|
49 |
gr.Interface(
|
50 |
predict,
|
51 |
inputs=[gr.components.Image(label="Upload Input Image", type="filepath"),
|
52 |
gr.components.Textbox(label='Model Name', value='sribd_med', max_lines=1)],
|
53 |
outputs=[gr.Image(label="Processed Image"),
|
54 |
-
gr.Image(label="
|
55 |
],
|
56 |
title="Cell Segmentation Results",
|
57 |
).launch()
|
|
|
43 |
my_model.load_checkpoints(checkpoints)
|
44 |
with torch.no_grad():
|
45 |
output = my_model(pre_img_data)
|
46 |
+
print(output.shape)
|
47 |
overlay = visualize_instances_map(pre_img_data,output)
|
48 |
+
print(pre_img_data.shape,overlay.shape)
|
49 |
#cv2.imwrite('prediction.png', cv2.cvtColor(overlay, cv2.COLOR_RGB2BGR))
|
50 |
+
return pre_img_data,overlay
|
51 |
gr.Interface(
|
52 |
predict,
|
53 |
inputs=[gr.components.Image(label="Upload Input Image", type="filepath"),
|
54 |
gr.components.Textbox(label='Model Name', value='sribd_med', max_lines=1)],
|
55 |
outputs=[gr.Image(label="Processed Image"),
|
56 |
+
gr.Image(label="Pred Image"),
|
57 |
],
|
58 |
title="Cell Segmentation Results",
|
59 |
).launch()
|