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

minor update

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -432,7 +432,8 @@ def plot_probabilities(probabilities):
432
  if len(probabilities) < 1:
433
  return None
434
  prob_df = pd.DataFrame({"labels": cell_types, "values": probabilities})
435
- prob_df.to_csv('./Cell_types_predictions.csv', index=False)
 
436
  return prob_df
437
 
438
  def run_mapping():
@@ -456,7 +457,7 @@ def run_registration(data_type, selected_idx):
456
  return "Registration complete!"
457
 
458
  def download_csv():
459
- return './Cell_types_predictions.csv'
460
 
461
 
462
  def handle_data_type_change(dt):
@@ -498,7 +499,7 @@ with gr.Blocks() as demo:
498
  gr.Markdown("### Step 5: Quantitative results of the mapping model.")
499
  prob_plot = gr.BarPlot(prob_df, x="labels", y="values", title="Cell Type Probabilities", scroll_to_output=True, x_label_angle=-90, height=400)
500
  gr.Markdown("### Step 6: Download Results.")
501
- download_button = gr.DownloadButton(label="Download Results", value='./Cell_types_predictions.csv')
502
 
503
  nifti_file.change(
504
  load_nifti_or_png,
 
432
  if len(probabilities) < 1:
433
  return None
434
  prob_df = pd.DataFrame({"labels": cell_types, "values": probabilities})
435
+ os.makedirs("outputs", exist_ok=True)
436
+ prob_df.to_csv('outputs/Cell_types_predictions.csv', index=False)
437
  return prob_df
438
 
439
  def run_mapping():
 
457
  return "Registration complete!"
458
 
459
  def download_csv():
460
+ return 'outputs/Cell_types_predictions.csv'
461
 
462
 
463
  def handle_data_type_change(dt):
 
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,