Skip to content

Commit

Permalink
Fixed CSS styling after gradio update
Browse files Browse the repository at this point in the history
  • Loading branch information
andreped committed Jun 21, 2024
1 parent 4146752 commit 5ad5add
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 25 deletions.
6 changes: 5 additions & 1 deletion demo/src/css_style.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
#upload {
height: 110px;
}
#download {
height: 47px;
width: 150px;
}
#run-button {
height: 110px;
height: 47px;
width: 150px;
}
#toggle-button {
Expand Down
38 changes: 14 additions & 24 deletions demo/src/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def run(self):
placeholder="\n" * 16,
label="Logs",
info="Verbose from inference will be displayed below.",
lines=38,
max_lines=38,
lines=36,
max_lines=36,
autoscroll=True,
elem_id="logs",
show_copy_button=True,
Expand All @@ -137,7 +137,7 @@ def run(self):

with gr.Column():
with gr.Row():
with gr.Column(scale=0.2, min_width=150):
with gr.Column(scale=1, min_width=150):
sidebar_state = gr.State(True)

btn_toggle_sidebar = gr.Button(
Expand All @@ -156,7 +156,7 @@ def run(self):
btn_clear_logs.click(flush_logs, [], [])

file_output = gr.File(
file_count="single", elem_id="upload"
file_count="single", elem_id="upload", scale=3,
)
file_output.upload(
self.upload_file, file_output, file_output
Expand All @@ -167,39 +167,31 @@ def run(self):
label="Task",
info="Which structure to segment.",
multiselect=False,
scale=1.0,
scale=1,
)
model_selector.input(
fn=lambda x: self.set_class_name(x),
inputs=model_selector,
outputs=None,
)

with gr.Column(scale=0.2, min_width=150):
with gr.Column(scale=1, min_width=150):
run_btn = gr.Button(
"Run analysis",
variant="primary",
elem_id="run-button",
#scale=1.0,
# size=1.0,
size="lg",
)
#.style(
# full_width=False,
# size="lg",
#)
run_btn.click(
fn=lambda x: self.process(x),
inputs=file_output,
outputs=self.volume_renderer,
)

download_btn = gr.DownloadButton(
"Download the result as NIfTI",
"Download prediction",
visible=True,
variant="secondary",
# scale=1.0,
size="sm",
elem_id="download",
)
download_btn.click(
fn=self.download_prediction,
Expand All @@ -226,18 +218,16 @@ def run(self):
)

with gr.Row():
with gr.Group(): #gr.Box():
with gr.Group():
with gr.Column():
# create dummy image to be replaced by loaded images
t = gr.AnnotatedImage(
visible=True, elem_id="model-2d"
visible=True,
elem_id="model-2d",
color_map={self.class_name: "#ffae00"},
#height=512,
#width=512,
)
#.style(
# color_map={self.class_name: "#ffae00"},
# height=512,
# width=512,
#)

self.slider.input(
self.get_img_pred_pair,
self.slider,
Expand Down

0 comments on commit 5ad5add

Please sign in to comment.