TibbtechUser commited on
Commit
0c75731
·
verified ·
1 Parent(s): 6db80d1

updated app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -439,7 +439,7 @@ def plot_probabilities(probabilities):
439
  def run_mapping():
440
  global last_probabilities
441
  last_probabilities = generate_random_probabilities()
442
- return plot_probabilities(last_probabilities), gr.update(visible=True)
443
 
444
  def run_registration(data_type, selected_idx):
445
  global vol, slice_idx
@@ -498,8 +498,8 @@ with gr.Blocks() as demo:
498
  with gr.Column(visible=False) as plot_row:
499
  gr.Markdown("### Step 5: Quantitative results of the mapping model.")
500
  prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height=400)
501
- gr.Markdown("### Step 6: Download Results.")
502
- download_button = gr.DownloadButton(label="Download Results", value='outputs/Cell_types_predictions.csv')
503
 
504
  nifti_file.change(
505
  load_nifti_or_png,
@@ -523,7 +523,7 @@ with gr.Blocks() as demo:
523
  gallery.select(on_select, None, None)
524
 
525
  slice_slider.change(update_slice, inputs=slice_slider, outputs=[image_display, prob_plot, gallery])
526
- run_button.click(run_mapping, outputs=[prob_plot, plot_row])
527
  reg_button.click(run_registration,inputs = [data_type], outputs=[gallery])
528
 
529
  demo.launch()
 
439
  def run_mapping():
440
  global last_probabilities
441
  last_probabilities = generate_random_probabilities()
442
+ return plot_probabilities(last_probabilities), gr.update(visible=True), gr.update(value = 'outputs/Cell_types_predictions.csv', visible = True), gr.update(visible=True)
443
 
444
  def run_registration(data_type, selected_idx):
445
  global vol, slice_idx
 
498
  with gr.Column(visible=False) as plot_row:
499
  gr.Markdown("### Step 5: Quantitative results of the mapping model.")
500
  prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height=400)
501
+ download_step = gr.Markdown("### Step 6: Download Results.", visible = False)
502
+ download_button = gr.DownloadButton(label="Download Results", visible = False)
503
 
504
  nifti_file.change(
505
  load_nifti_or_png,
 
523
  gallery.select(on_select, None, None)
524
 
525
  slice_slider.change(update_slice, inputs=slice_slider, outputs=[image_display, prob_plot, gallery])
526
+ run_button.click(run_mapping, outputs=[prob_plot, plot_row, download_button, download_step])
527
  reg_button.click(run_registration,inputs = [data_type], outputs=[gallery])
528
 
529
  demo.launch()