re-type commited on
Commit
447480d
·
verified ·
1 Parent(s): 6526046

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -624,48 +624,48 @@ def create_gradio_interface():
624
  with gr.TabItem("📝 Text Input"):
625
  with gr.Row():
626
  with gr.Column(scale=2):
627
- gr.Markdown("Paste your DNA sequence here") # Moved description
628
  dna_input = gr.Textbox(
629
  label="🧬 DNA Sequence",
630
  placeholder="Enter DNA sequence (ATCG format)...",
631
  lines=5
632
  )
633
  with gr.Column(scale=1):
 
634
  similarity_score = gr.Slider(
635
  minimum=1,
636
  maximum=99,
637
  value=95.0,
638
  step=1.0,
639
- label="🎯 Similarity Threshold (%)",
640
- description="Minimum similarity for tree analysis" # Valid for Slider
641
  )
 
642
  build_ml_tree = gr.Checkbox(
643
  label="🌲 Build ML Tree",
644
- value=False,
645
- description="Generate phylogenetic placement (slower)" # Valid for Checkbox
646
  )
647
  analyze_btn = gr.Button("🔬 Analyze Sequence", variant="primary")
648
  with gr.TabItem("📁 File Upload"):
649
  with gr.Row():
650
  with gr.Column(scale=2):
 
651
  file_input = gr.File(
652
  label="📄 Upload FASTA File",
653
- file_types=[".fasta", ".fa", ".fas", ".txt"],
654
- description="Upload a FASTA file containing your sequence"
655
  )
656
  with gr.Column(scale=1):
 
657
  file_similarity_score = gr.Slider(
658
  minimum=1,
659
  maximum=99,
660
  value=95.0,
661
  step=1.0,
662
- label="🎯 Similarity Threshold (%)",
663
- description="Minimum similarity for tree analysis"
664
  )
 
665
  file_build_ml_tree = gr.Checkbox(
666
  label="🌲 Build ML Tree",
667
- value=False,
668
- description="Generate phylogenetic placement (slower)"
669
  )
670
  analyze_file_btn = gr.Button("🔬 Analyze File", variant="primary")
671
  gr.Markdown("## 📊 Analysis Results")
@@ -777,15 +777,14 @@ def create_gradio_interface():
777
  """)
778
 
779
  return iface
780
- except Exception as e:
781
- logger.error(f"Gradio interface creation failed: {e}", exc_info=True)
782
  return gr.Interface(
783
- fn=lambda x: f"Error: {str(e)}",
784
  inputs=gr.Textbox(label="DNA Sequence"),
785
  outputs=gr.Textbox(label="Error"),
786
  title="🧬 Gene Analysis Pipeline (Error Mode)"
787
  )
788
-
789
  # --- Application Startup ---
790
  def run_application():
791
  try:
 
624
  with gr.TabItem("📝 Text Input"):
625
  with gr.Row():
626
  with gr.Column(scale=2):
627
+ gr.Markdown("Paste your DNA sequence here")
628
  dna_input = gr.Textbox(
629
  label="🧬 DNA Sequence",
630
  placeholder="Enter DNA sequence (ATCG format)...",
631
  lines=5
632
  )
633
  with gr.Column(scale=1):
634
+ gr.Markdown("Minimum similarity for tree analysis")
635
  similarity_score = gr.Slider(
636
  minimum=1,
637
  maximum=99,
638
  value=95.0,
639
  step=1.0,
640
+ label="🎯 Similarity Threshold (%)"
 
641
  )
642
+ gr.Markdown("Generate phylogenetic placement (slower)")
643
  build_ml_tree = gr.Checkbox(
644
  label="🌲 Build ML Tree",
645
+ value=False
 
646
  )
647
  analyze_btn = gr.Button("🔬 Analyze Sequence", variant="primary")
648
  with gr.TabItem("📁 File Upload"):
649
  with gr.Row():
650
  with gr.Column(scale=2):
651
+ gr.Markdown("Upload a FASTA file containing your sequence")
652
  file_input = gr.File(
653
  label="📄 Upload FASTA File",
654
+ file_types=[".fasta", ".fa", ".fas", ".txt"]
 
655
  )
656
  with gr.Column(scale=1):
657
+ gr.Markdown("Minimum similarity for tree analysis")
658
  file_similarity_score = gr.Slider(
659
  minimum=1,
660
  maximum=99,
661
  value=95.0,
662
  step=1.0,
663
+ label="🎯 Similarity Threshold (%)"
 
664
  )
665
+ gr.Markdown("Generate phylogenetic placement (slower)")
666
  file_build_ml_tree = gr.Checkbox(
667
  label="🌲 Build ML Tree",
668
+ value=False
 
669
  )
670
  analyze_file_btn = gr.Button("🔬 Analyze File", variant="primary")
671
  gr.Markdown("## 📊 Analysis Results")
 
777
  """)
778
 
779
  return iface
780
+ except Exception as main_error:
781
+ logger.error(f"Gradio interface creation failed: {main_error}", exc_info=True)
782
  return gr.Interface(
783
+ fn=lambda x: f"Error: {str(main_error)}",
784
  inputs=gr.Textbox(label="DNA Sequence"),
785
  outputs=gr.Textbox(label="Error"),
786
  title="🧬 Gene Analysis Pipeline (Error Mode)"
787
  )
 
788
  # --- Application Startup ---
789
  def run_application():
790
  try: