TibbtechUser commited on
Commit
255da82
·
verified ·
1 Parent(s): d20a3a3

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -36,7 +36,7 @@ def load_nifti(file):
36
  mid_index = vol.shape[0] // 2
37
  slice_img = Image.fromarray((coronal_slices[mid_index] / np.max(coronal_slices[mid_index]) * 255).astype(np.uint8))
38
  gallery_images = load_gallery_images()
39
- return slice_img, gr.update(visible=True, maximum=len(coronal_slices)-1, value=mid_index), gallery_images, gr.update(visible=True), gr.update(visible=False)
40
 
41
  def update_slice(index):
42
  if not coronal_slices:
@@ -53,8 +53,7 @@ def update_slice(index):
53
  new_probs = np.clip(np.array(last_probabilities) + noise, 0, None)
54
  new_probs /= new_probs.sum()
55
  else:
56
- new_probs = generate_random_probabilities()
57
-
58
  return slice_img, plot_probabilities(new_probs), gallery_selection
59
 
60
  def load_gallery_images():
@@ -115,7 +114,7 @@ with gr.Blocks() as demo:
115
 
116
  with gr.Column(visible=False) as plot_row:
117
  gr.Markdown("### Step 5: Quantitative results of the mapping model.")
118
- prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height = 600)
119
  gr.Markdown("### Step 6: Download Results.")
120
  download_button = gr.DownloadButton(label="Download Results", value='./Cell_types_predictions.csv')
121
 
 
36
  mid_index = vol.shape[0] // 2
37
  slice_img = Image.fromarray((coronal_slices[mid_index] / np.max(coronal_slices[mid_index]) * 255).astype(np.uint8))
38
  gallery_images = load_gallery_images()
39
+ return slice_img, gr.update(visible=True, maximum=len(coronal_slices)-1, value=mid_index), gallery_images, gr.update(visible=True), gr.update(visible=True)
40
 
41
  def update_slice(index):
42
  if not coronal_slices:
 
53
  new_probs = np.clip(np.array(last_probabilities) + noise, 0, None)
54
  new_probs /= new_probs.sum()
55
  else:
56
+ new_probs = []
 
57
  return slice_img, plot_probabilities(new_probs), gallery_selection
58
 
59
  def load_gallery_images():
 
114
 
115
  with gr.Column(visible=False) as plot_row:
116
  gr.Markdown("### Step 5: Quantitative results of the mapping model.")
117
+ prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height = 400)
118
  gr.Markdown("### Step 6: Download Results.")
119
  download_button = gr.DownloadButton(label="Download Results", value='./Cell_types_predictions.csv')
120