Spaces:
Runtime error
Runtime error
updated app.py
Browse files438 unmodified lines43944044144244344444552 unmodified lines49849950050150250350450517 unmodified lines523524525526527528529438 unmodified linesdef run_mapping():global last_probabilitieslast_probabilities = generate_random_probabilities()return plot_probabilities(last_probabilities), gr.update(visible=True)def run_registration(data_type, selected_idx):global vol, slice_idx52 unmodified lineswith gr.Column(visible=False) as plot_row:gr.Markdown("### Step 5: Quantitative results of the mapping model.")prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height=400)gr.Markdown("### Step 6: Download Results.")download_button = gr.DownloadButton(label="Download Results", value='outputs/Cell_types_predictions.csv')nifti_file.change(load_nifti_or_png,17 unmodified linesgallery.select(on_select, None, None)slice_slider.change(update_slice, inputs=slice_slider, outputs=[image_display, prob_plot, gallery])run_button.click(run_mapping, outputs=[prob_plot, plot_row])reg_button.click(run_registration,inputs = [data_type], outputs=[gallery])demo.launch()438 unmodified lines43944044144244344444552 unmodified lines49849950050150250350450517 unmodified lines523524525526527528529438 unmodified linesdef run_mapping():global last_probabilitieslast_probabilities = generate_random_probabilities()return plot_probabilities(last_probabilities), gr.update(visible=True), gr.update(value = 'outputs/Cell_types_predictions.csv', visible = True), gr.update(visible=True)def run_registration(data_type, selected_idx):global vol, slice_idx52 unmodified lineswith gr.Column(visible=False) as plot_row:gr.Markdown("### Step 5: Quantitative results of the mapping model.")prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height=400)download_step = gr.Markdown("### Step 6: Download Results.", visible = False)download_button = gr.DownloadButton(label="Download Results", visible = False)nifti_file.change(load_nifti_or_png,17 unmodified linesgallery.select(on_select, None, None)slice_slider.change(update_slice, inputs=slice_slider, outputs=[image_display, prob_plot, gallery])run_button.click(run_mapping, outputs=[prob_plot, plot_row, download_button, download_step])reg_button.click(run_registration,inputs = [data_type], outputs=[gallery])demo.launch()
app.py+4-4