Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1006,6 +1006,23 @@ def load_example_fasta():
|
|
1006 |
###############################################################################
|
1007 |
|
1008 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1009 |
css = """
|
1010 |
.gradio-container {
|
1011 |
font-family: 'IBM Plex Sans', sans-serif;
|
@@ -1045,8 +1062,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 |
-
#
|
1049 |
-
download_kmer_shap = gr.File(label="Download k-mer SHAP Values (CSV)", visible=True, type="
|
1050 |
download_results = gr.File(label="Download Results", visible=True, elem_classes="download-button")
|
1051 |
|
1052 |
seq_state = gr.State()
|
@@ -1114,7 +1131,7 @@ with gr.Blocks(css=css) as iface:
|
|
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="
|
1118 |
|
1119 |
analyze_genes_btn.click(
|
1120 |
analyze_gene_features,
|
|
|
1006 |
###############################################################################
|
1007 |
|
1008 |
|
1009 |
+
###############################################################################
|
1010 |
+
# 13. EXAMPLE FASTA LOADER
|
1011 |
+
###############################################################################
|
1012 |
+
|
1013 |
+
def load_example_fasta():
|
1014 |
+
"""Load the example.fasta file contents"""
|
1015 |
+
try:
|
1016 |
+
with open('example.fasta', 'r') as f:
|
1017 |
+
example_text = f.read()
|
1018 |
+
return example_text
|
1019 |
+
except Exception as e:
|
1020 |
+
return f">example_sequence\nACGTACGT...\n\n(Note: Could not load example.fasta: {str(e)})"
|
1021 |
+
|
1022 |
+
###############################################################################
|
1023 |
+
# 14. BUILD GRADIO INTERFACE
|
1024 |
+
###############################################################################
|
1025 |
+
|
1026 |
css = """
|
1027 |
.gradio-container {
|
1028 |
font-family: 'IBM Plex Sans', sans-serif;
|
|
|
1062 |
kmer_img = gr.Image(label="Top k-mer SHAP")
|
1063 |
genome_img = gr.Image(label="Genome-wide SHAP Heatmap (Blue=neg, White=0, Red=pos)")
|
1064 |
|
1065 |
+
# File components with the correct type parameter
|
1066 |
+
download_kmer_shap = gr.File(label="Download k-mer SHAP Values (CSV)", visible=True, type="filepath")
|
1067 |
download_results = gr.File(label="Download Results", visible=True, elem_classes="download-button")
|
1068 |
|
1069 |
seq_state = gr.State()
|
|
|
1131 |
analyze_genes_btn = gr.Button("Analyze Gene Features", variant="primary")
|
1132 |
gene_results = gr.Textbox(label="Gene Analysis Results", lines=12, interactive=False)
|
1133 |
gene_diagram = gr.Image(label="Genome Diagram with Gene Features")
|
1134 |
+
download_gene_results = gr.File(label="Download Gene Analysis (CSV)", visible=True, type="filepath")
|
1135 |
|
1136 |
analyze_genes_btn.click(
|
1137 |
analyze_gene_features,
|