Geonomic commited on
Commit
dcb2478
Β·
verified Β·
1 Parent(s): d4d4b28

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -5
app.py CHANGED
@@ -217,7 +217,14 @@ def get_genomic_context(sequence, is_coding):
217
  # ==============================
218
  def gradio_inference(dna_sequence, run_mapping):
219
  if len(dna_sequence.strip()) < 10:
220
- yield ("<div style='color: #dc3545; font-size: 1.15em;'>❌ Sequence too short! Please enter at least 10 base pairs.</div>", "", "", "")
 
 
 
 
 
 
 
221
  return
222
 
223
  # Run AI Models (GPU)
@@ -326,11 +333,27 @@ with gr.Blocks(theme=gr.themes.Soft(), title="🧬 The Genomic Oracle 🧬", css
326
  dna_input = gr.Textbox(label="Enter DNA Sequence", placeholder="e.g., ATGCGATCGATCGATCG...", lines=10)
327
  run_mapping_cb = gr.Checkbox(value=False, label="Query NCBI BLAST for spatial mapping (Takes 1–3 mins)")
328
  submit_btn = gr.Button("πŸš€ Initialize Deep Scan", elem_id="scan_btn")
329
-
330
  with gr.Column(scale=1):
331
- # Swapped from Textbox to HTML to allow our custom bolding and sizing!
332
- output_summary = gr.HTML()
333
- stats_panel = gr.HTML()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
334
  mapping_section = gr.Accordion("Genomic Context (BLAST/Ensembl)", open=False)
335
  with mapping_section:
336
  context_output = gr.Textbox(label="Mapping Results", lines=5, placeholder="Results will appear here...")
 
217
  # ==============================
218
  def gradio_inference(dna_sequence, run_mapping):
219
  if len(dna_sequence.strip()) < 10:
220
+ error_html = f"""
221
+ <div style="border: 1px solid #dc3545; border-radius: 8px; padding: 15px; margin-bottom: 15px;">
222
+ <h3 style="margin-top: 0; margin-bottom: 10px; color: #dc3545;">❌ Classification Summary</h3>
223
+ <div style="font-size: 1.15em;">Sequence too short! Please enter at least 10 base pairs.</div>
224
+ </div>
225
+ """
226
+ # Updated the placeholder text here as well!
227
+ yield (error_html, "<div style='border: 1px solid #4b5563; border-radius: 8px; padding: 15px; margin-bottom: 15px;'><h3 style='margin-top: 0; margin-bottom: 10px;'>πŸ“Š Internal Pipeline Statistics</h3><div style='color: #9ca3af; font-style: italic;'>Results will appear here...</div></div>", "", "")
228
  return
229
 
230
  # Run AI Models (GPU)
 
333
  dna_input = gr.Textbox(label="Enter DNA Sequence", placeholder="e.g., ATGCGATCGATCGATCG...", lines=10)
334
  run_mapping_cb = gr.Checkbox(value=False, label="Query NCBI BLAST for spatial mapping (Takes 1–3 mins)")
335
  submit_btn = gr.Button("πŸš€ Initialize Deep Scan", elem_id="scan_btn")
336
+
337
  with gr.Column(scale=1):
338
+ # 🎨 Create default placeholder HTML so the boxes are visible on startup!
339
+ default_summary = """
340
+ <div style="border: 1px solid #4b5563; border-radius: 8px; padding: 15px; margin-bottom: 15px;">
341
+ <h3 style="margin-top: 0; margin-bottom: 10px;">βœ… Classification Summary</h3>
342
+ <div style="color: #9ca3af; font-style: italic;">Results will appear here...</div>
343
+ </div>
344
+ """
345
+
346
+ default_stats = """
347
+ <div style="border: 1px solid #4b5563; border-radius: 8px; padding: 15px; margin-bottom: 15px;">
348
+ <h3 style="margin-top: 0; margin-bottom: 10px;">πŸ“Š Internal Pipeline Statistics</h3>
349
+ <div style="color: #9ca3af; font-style: italic;">Results will appear here...</div>
350
+ </div>
351
+ """
352
+
353
+ # Pass the default HTML into the components
354
+ output_summary = gr.HTML(value=default_summary)
355
+ stats_panel = gr.HTML(value=default_stats)
356
+
357
  mapping_section = gr.Accordion("Genomic Context (BLAST/Ensembl)", open=False)
358
  with mapping_section:
359
  context_output = gr.Textbox(label="Mapping Results", lines=5, placeholder="Results will appear here...")