Spaces:
Running
Running
Fixed CSS styling after gradio update
Browse files- demo/src/css_style.py +5 -1
- demo/src/gui.py +14 -24
demo/src/css_style.py
CHANGED
|
@@ -9,8 +9,12 @@ margin: auto;
|
|
| 9 |
#upload {
|
| 10 |
height: 110px;
|
| 11 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
#run-button {
|
| 13 |
-
height:
|
| 14 |
width: 150px;
|
| 15 |
}
|
| 16 |
#toggle-button {
|
|
|
|
| 9 |
#upload {
|
| 10 |
height: 110px;
|
| 11 |
}
|
| 12 |
+
#download {
|
| 13 |
+
height: 47px;
|
| 14 |
+
width: 150px;
|
| 15 |
+
}
|
| 16 |
#run-button {
|
| 17 |
+
height: 47px;
|
| 18 |
width: 150px;
|
| 19 |
}
|
| 20 |
#toggle-button {
|
demo/src/gui.py
CHANGED
|
@@ -126,8 +126,8 @@ class WebUI:
|
|
| 126 |
placeholder="\n" * 16,
|
| 127 |
label="Logs",
|
| 128 |
info="Verbose from inference will be displayed below.",
|
| 129 |
-
lines=
|
| 130 |
-
max_lines=
|
| 131 |
autoscroll=True,
|
| 132 |
elem_id="logs",
|
| 133 |
show_copy_button=True,
|
|
@@ -137,7 +137,7 @@ class WebUI:
|
|
| 137 |
|
| 138 |
with gr.Column():
|
| 139 |
with gr.Row():
|
| 140 |
-
with gr.Column(scale=
|
| 141 |
sidebar_state = gr.State(True)
|
| 142 |
|
| 143 |
btn_toggle_sidebar = gr.Button(
|
|
@@ -156,7 +156,7 @@ class WebUI:
|
|
| 156 |
btn_clear_logs.click(flush_logs, [], [])
|
| 157 |
|
| 158 |
file_output = gr.File(
|
| 159 |
-
file_count="single", elem_id="upload"
|
| 160 |
)
|
| 161 |
file_output.upload(
|
| 162 |
self.upload_file, file_output, file_output
|
|
@@ -167,7 +167,7 @@ class WebUI:
|
|
| 167 |
label="Task",
|
| 168 |
info="Which structure to segment.",
|
| 169 |
multiselect=False,
|
| 170 |
-
scale=1
|
| 171 |
)
|
| 172 |
model_selector.input(
|
| 173 |
fn=lambda x: self.set_class_name(x),
|
|
@@ -175,19 +175,12 @@ class WebUI:
|
|
| 175 |
outputs=None,
|
| 176 |
)
|
| 177 |
|
| 178 |
-
with gr.Column(scale=
|
| 179 |
run_btn = gr.Button(
|
| 180 |
"Run analysis",
|
| 181 |
variant="primary",
|
| 182 |
elem_id="run-button",
|
| 183 |
-
#scale=1.0,
|
| 184 |
-
# size=1.0,
|
| 185 |
-
size="lg",
|
| 186 |
)
|
| 187 |
-
#.style(
|
| 188 |
-
# full_width=False,
|
| 189 |
-
# size="lg",
|
| 190 |
-
#)
|
| 191 |
run_btn.click(
|
| 192 |
fn=lambda x: self.process(x),
|
| 193 |
inputs=file_output,
|
|
@@ -195,11 +188,10 @@ class WebUI:
|
|
| 195 |
)
|
| 196 |
|
| 197 |
download_btn = gr.DownloadButton(
|
| 198 |
-
"Download
|
| 199 |
visible=True,
|
| 200 |
variant="secondary",
|
| 201 |
-
|
| 202 |
-
size="sm",
|
| 203 |
)
|
| 204 |
download_btn.click(
|
| 205 |
fn=self.download_prediction,
|
|
@@ -226,18 +218,16 @@ class WebUI:
|
|
| 226 |
)
|
| 227 |
|
| 228 |
with gr.Row():
|
| 229 |
-
with gr.Group():
|
| 230 |
with gr.Column():
|
| 231 |
# create dummy image to be replaced by loaded images
|
| 232 |
t = gr.AnnotatedImage(
|
| 233 |
-
visible=True,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
)
|
| 235 |
-
#.style(
|
| 236 |
-
# color_map={self.class_name: "#ffae00"},
|
| 237 |
-
# height=512,
|
| 238 |
-
# width=512,
|
| 239 |
-
#)
|
| 240 |
-
|
| 241 |
self.slider.input(
|
| 242 |
self.get_img_pred_pair,
|
| 243 |
self.slider,
|
|
|
|
| 126 |
placeholder="\n" * 16,
|
| 127 |
label="Logs",
|
| 128 |
info="Verbose from inference will be displayed below.",
|
| 129 |
+
lines=36,
|
| 130 |
+
max_lines=36,
|
| 131 |
autoscroll=True,
|
| 132 |
elem_id="logs",
|
| 133 |
show_copy_button=True,
|
|
|
|
| 137 |
|
| 138 |
with gr.Column():
|
| 139 |
with gr.Row():
|
| 140 |
+
with gr.Column(scale=1, min_width=150):
|
| 141 |
sidebar_state = gr.State(True)
|
| 142 |
|
| 143 |
btn_toggle_sidebar = gr.Button(
|
|
|
|
| 156 |
btn_clear_logs.click(flush_logs, [], [])
|
| 157 |
|
| 158 |
file_output = gr.File(
|
| 159 |
+
file_count="single", elem_id="upload", scale=3,
|
| 160 |
)
|
| 161 |
file_output.upload(
|
| 162 |
self.upload_file, file_output, file_output
|
|
|
|
| 167 |
label="Task",
|
| 168 |
info="Which structure to segment.",
|
| 169 |
multiselect=False,
|
| 170 |
+
scale=1,
|
| 171 |
)
|
| 172 |
model_selector.input(
|
| 173 |
fn=lambda x: self.set_class_name(x),
|
|
|
|
| 175 |
outputs=None,
|
| 176 |
)
|
| 177 |
|
| 178 |
+
with gr.Column(scale=1, min_width=150):
|
| 179 |
run_btn = gr.Button(
|
| 180 |
"Run analysis",
|
| 181 |
variant="primary",
|
| 182 |
elem_id="run-button",
|
|
|
|
|
|
|
|
|
|
| 183 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
run_btn.click(
|
| 185 |
fn=lambda x: self.process(x),
|
| 186 |
inputs=file_output,
|
|
|
|
| 188 |
)
|
| 189 |
|
| 190 |
download_btn = gr.DownloadButton(
|
| 191 |
+
"Download prediction",
|
| 192 |
visible=True,
|
| 193 |
variant="secondary",
|
| 194 |
+
elem_id="download",
|
|
|
|
| 195 |
)
|
| 196 |
download_btn.click(
|
| 197 |
fn=self.download_prediction,
|
|
|
|
| 218 |
)
|
| 219 |
|
| 220 |
with gr.Row():
|
| 221 |
+
with gr.Group():
|
| 222 |
with gr.Column():
|
| 223 |
# create dummy image to be replaced by loaded images
|
| 224 |
t = gr.AnnotatedImage(
|
| 225 |
+
visible=True,
|
| 226 |
+
elem_id="model-2d",
|
| 227 |
+
color_map={self.class_name: "#ffae00"},
|
| 228 |
+
#height=512,
|
| 229 |
+
#width=512,
|
| 230 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 231 |
self.slider.input(
|
| 232 |
self.get_img_pred_pair,
|
| 233 |
self.slider,
|