Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -107,6 +107,25 @@ 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 |
@output(id="plot_" + str(i))
|
| 111 |
@render.plot
|
| 112 |
def plot_prediction():
|
|
@@ -135,26 +154,7 @@ def server(input, output, session: Session):
|
|
| 135 |
ax.imshow(cv2.cvtColor(out.get_image()[:, :, ::-1], cv2.COLOR_BGR2RGB))
|
| 136 |
|
| 137 |
return fig
|
| 138 |
-
|
| 139 |
-
ui_output.append(
|
| 140 |
-
ui.div(
|
| 141 |
-
ui.row(
|
| 142 |
-
ui.column(4, ui.img(src=f"data:image/png;base64,{r['image_base64']}")),
|
| 143 |
-
ui.column(4, ui.output_plot("plot_" + str(i))),
|
| 144 |
-
),
|
| 145 |
-
opacity,
|
| 146 |
-
ui.h5(r['filename'], style="margin-top: 15px;"),
|
| 147 |
-
ui.div(
|
| 148 |
-
ui.span(f"Viable = {r.get('viable', '? ')}", style="margin: 0 15px;"),
|
| 149 |
-
ui.span(f"Nonviable = {r.get('non-viable', '? ')}", style="margin: 0 15px;"),
|
| 150 |
-
ui.span(f"Empty = {r.get('empty', '? ')}", style="margin: 0 15px;"),
|
| 151 |
-
ui.span(f"Total = {r.get('total', '? ')}", style="margin: 0 15px;"),
|
| 152 |
-
class_="results-text"
|
| 153 |
-
),
|
| 154 |
-
class_="card p-3"
|
| 155 |
-
)
|
| 156 |
-
)
|
| 157 |
-
# output(create_plot(r, input[id]()), id=plot_name)
|
| 158 |
return ui.div(ui_output)
|
| 159 |
|
| 160 |
@session.download()
|
|
|
|
| 107 |
id = "image_" + str(i)
|
| 108 |
opacity = ui.input_slider(id, "Opacity", 0, 1.0, 0.5),
|
| 109 |
|
| 110 |
+
ui_output.append(
|
| 111 |
+
ui.div(
|
| 112 |
+
ui.row(
|
| 113 |
+
ui.column(4, ui.img(src=f"data:image/png;base64,{r['image_base64']}")),
|
| 114 |
+
ui.column(4, ui.output_plot("plot_" + str(i))),
|
| 115 |
+
),
|
| 116 |
+
opacity,
|
| 117 |
+
ui.h5(r['filename'], style="margin-top: 15px;"),
|
| 118 |
+
ui.div(
|
| 119 |
+
ui.span(f"Viable = {r.get('viable', '? ')}", style="margin: 0 15px;"),
|
| 120 |
+
ui.span(f"Nonviable = {r.get('non-viable', '? ')}", style="margin: 0 15px;"),
|
| 121 |
+
ui.span(f"Empty = {r.get('empty', '? ')}", style="margin: 0 15px;"),
|
| 122 |
+
ui.span(f"Total = {r.get('total', '? ')}", style="margin: 0 15px;"),
|
| 123 |
+
class_="results-text"
|
| 124 |
+
),
|
| 125 |
+
class_="card p-3"
|
| 126 |
+
)
|
| 127 |
+
)
|
| 128 |
+
|
| 129 |
@output(id="plot_" + str(i))
|
| 130 |
@render.plot
|
| 131 |
def plot_prediction():
|
|
|
|
| 154 |
ax.imshow(cv2.cvtColor(out.get_image()[:, :, ::-1], cv2.COLOR_BGR2RGB))
|
| 155 |
|
| 156 |
return fig
|
| 157 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
return ui.div(ui_output)
|
| 159 |
|
| 160 |
@session.download()
|