Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,38 +107,38 @@ def server(input, output, session: Session):
|
|
| 107 |
id = "image_" + str(i)
|
| 108 |
opacity = ui.input_slider(id, "Opacity", 0, 1.0, 0.5)
|
| 109 |
|
| 110 |
-
def create_plot_function(name, opacity):
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
|
| 119 |
-
|
| 120 |
-
|
| 121 |
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
|
| 136 |
-
|
| 137 |
|
| 138 |
-
|
| 139 |
-
|
| 140 |
|
| 141 |
-
plot_function = create_plot_function("plot_" + str(i), input[id]())
|
| 142 |
|
| 143 |
output.append(
|
| 144 |
ui.div(
|
|
|
|
| 107 |
id = "image_" + str(i)
|
| 108 |
opacity = ui.input_slider(id, "Opacity", 0, 1.0, 0.5)
|
| 109 |
|
| 110 |
+
# def create_plot_function(name, opacity):
|
| 111 |
+
# @render.plot
|
| 112 |
+
# def plot_predicitons():
|
| 113 |
+
# fig, ax = plt.subplots()
|
| 114 |
|
| 115 |
+
# ax = plt.Axes(fig, [0., 0., 1., 1.])
|
| 116 |
+
# ax.set_axis_off()
|
| 117 |
+
# fig.add_axes(ax)
|
| 118 |
|
| 119 |
+
# v = Visualizer(r["image"][:, :, ::-1],
|
| 120 |
+
# scale=1, instance_mode=ColorMode.SEGMENTATION, font_size_scale=1)
|
| 121 |
|
| 122 |
+
# colours = []
|
| 123 |
+
# for cls in r["instances"].pred_classes:
|
| 124 |
+
# if cls == 0:
|
| 125 |
+
# colours.append([1,0,0])
|
| 126 |
+
# elif cls == 1:
|
| 127 |
+
# colours.append([1,1,0])
|
| 128 |
+
# elif cls == 2:
|
| 129 |
+
# colours.append([0,0,0])
|
| 130 |
|
| 131 |
+
# out = v.overlay_instances(masks = r["instances"].pred_masks.to("cpu"),
|
| 132 |
+
# assigned_colors = colours,
|
| 133 |
+
# alpha = opacity)
|
| 134 |
+
# ax.imshow(cv2.cvtColor(out.get_image()[:, :, ::-1], cv2.COLOR_BGR2RGB))
|
| 135 |
|
| 136 |
+
# return fig
|
| 137 |
|
| 138 |
+
# plot_prediction.__name__ = name
|
| 139 |
+
# return plot_prediction
|
| 140 |
|
| 141 |
+
# plot_function = create_plot_function("plot_" + str(i), input[id]())
|
| 142 |
|
| 143 |
output.append(
|
| 144 |
ui.div(
|