hiyata commited on
Commit
e5a3715
·
verified ·
1 Parent(s): b6ec5a3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -1045,8 +1045,8 @@ with gr.Blocks(css=css) as iface:
1045
  kmer_img = gr.Image(label="Top k-mer SHAP")
1046
  genome_img = gr.Image(label="Genome-wide SHAP Heatmap (Blue=neg, White=0, Red=pos)")
1047
 
1048
- # Make both download buttons visible
1049
- download_kmer_shap = gr.File(label="Download k-mer SHAP Values (CSV)", visible=True)
1050
  download_results = gr.File(label="Download Results", visible=True, elem_classes="download-button")
1051
 
1052
  seq_state = gr.State()
@@ -1060,14 +1060,13 @@ with gr.Blocks(css=css) as iface:
1060
  outputs=[text_input]
1061
  )
1062
 
1063
- # Important: Make sure we have 7 outputs to match the 7 values returned by analyze_sequence
1064
  analyze_btn.click(
1065
  analyze_sequence,
1066
  inputs=[file_input, top_k, text_input, win_size],
1067
  outputs=[results_box, kmer_img, genome_img, seq_state, header_state, download_results, download_kmer_shap]
1068
  )
1069
 
1070
-
1071
  with gr.Tab("2) Subregion Exploration"):
1072
  gr.Markdown("""
1073
  **Subregion Analysis**
@@ -1115,7 +1114,7 @@ with gr.Blocks(css=css) as iface:
1115
  analyze_genes_btn = gr.Button("Analyze Gene Features", variant="primary")
1116
  gene_results = gr.Textbox(label="Gene Analysis Results", lines=12, interactive=False)
1117
  gene_diagram = gr.Image(label="Genome Diagram with Gene Features")
1118
- download_gene_results = gr.File(label="Download Gene Analysis (CSV)", visible=True)
1119
 
1120
  analyze_genes_btn.click(
1121
  analyze_gene_features,
 
1045
  kmer_img = gr.Image(label="Top k-mer SHAP")
1046
  genome_img = gr.Image(label="Genome-wide SHAP Heatmap (Blue=neg, White=0, Red=pos)")
1047
 
1048
+ # Make sure we use type="file" and not include a tuple in the return value
1049
+ download_kmer_shap = gr.File(label="Download k-mer SHAP Values (CSV)", visible=True, type="file")
1050
  download_results = gr.File(label="Download Results", visible=True, elem_classes="download-button")
1051
 
1052
  seq_state = gr.State()
 
1060
  outputs=[text_input]
1061
  )
1062
 
1063
+ # Connect the analyze button
1064
  analyze_btn.click(
1065
  analyze_sequence,
1066
  inputs=[file_input, top_k, text_input, win_size],
1067
  outputs=[results_box, kmer_img, genome_img, seq_state, header_state, download_results, download_kmer_shap]
1068
  )
1069
 
 
1070
  with gr.Tab("2) Subregion Exploration"):
1071
  gr.Markdown("""
1072
  **Subregion Analysis**
 
1114
  analyze_genes_btn = gr.Button("Analyze Gene Features", variant="primary")
1115
  gene_results = gr.Textbox(label="Gene Analysis Results", lines=12, interactive=False)
1116
  gene_diagram = gr.Image(label="Genome Diagram with Gene Features")
1117
+ download_gene_results = gr.File(label="Download Gene Analysis (CSV)", visible=True, type="file")
1118
 
1119
  analyze_genes_btn.click(
1120
  analyze_gene_features,