re-type commited on
Commit
eafd943
·
verified ·
1 Parent(s): b82ceb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -22
app.py CHANGED
@@ -713,30 +713,21 @@ def create_gradio_interface():
713
  value="<div style='text-align: center; color: #666; padding: 20px;'>No report generated yet. Run analysis to see results.</div>"
714
  )
715
 
716
- # Event handlers with enhanced logging
717
  def handle_analysis_output(*outputs):
718
- try:
719
- boundary_output, keras_output, ml_tree_output, simplified_ml_output, summary_output, aligned_file, phy_file, _, _, tree_html_content, report_html_content, tree_html_path, report_html_path = outputs
720
- return (
721
- boundary_output, keras_output, ml_tree_output, simplified_ml_output, summary_output,
722
- gr.File.update(value=aligned_file, visible=aligned_file is not None),
723
- gr.File.update(value=phy_file, visible=phy_file is not None),
724
- gr.File.update(value=tree_html_path, visible=tree_html_path is not None),
725
- gr.File.update(value=report_html_path, visible=report_html_path is not None),
726
- tree_html_content,
727
- report_html_content
728
- )
729
- except Exception as handler_error:
730
- logger.error(f"Error in handle_analysis_output: {handler_error}", exc_info=True)
731
- return (
732
- f"Error: {str(handler_error)}", "", "", "", "",
733
- gr.File.update(visible=False), gr.File.update(visible=False),
734
- gr.File.update(visible=False), gr.File.update(visible=False),
735
- "", ""
736
- )
737
 
738
  analyze_btn.click(
739
- fn=lambda *args: handle_analysis_output(run_pipeline(*args)),
740
  inputs=[dna_input, similarity_score, build_ml_tree],
741
  outputs=[
742
  boundary_output, keras_output, ml_tree_output, tree_analysis_output, summary_output,
@@ -745,7 +736,7 @@ def create_gradio_interface():
745
  )
746
 
747
  analyze_file_btn.click(
748
- fn=lambda *args: handle_analysis_output(run_pipeline_from_file(*args)),
749
  inputs=[file_input, file_similarity_score, file_build_ml_tree],
750
  outputs=[
751
  boundary_output, keras_output, ml_tree_output, tree_analysis_output, summary_output,
 
713
  value="<div style='text-align: center; color: #666; padding: 20px;'>No report generated yet. Run analysis to see results.</div>"
714
  )
715
 
716
+ # Event handlers
717
  def handle_analysis_output(*outputs):
718
+ boundary_output, keras_output, ml_tree_output, simplified_ml_output, summary_output, aligned_file, phy_file, _, _, tree_html_content, report_html_content, tree_html_path, report_html_path = outputs
719
+ return (
720
+ boundary_output, keras_output, ml_tree_output, simplified_ml_output, summary_output,
721
+ gr.File.update(value=aligned_file, visible=aligned_file is not None),
722
+ gr.File.update(value=phy_file, visible=phy_file is not None),
723
+ gr.File.update(value=tree_html_path, visible=tree_html_path is not None),
724
+ gr.File.update(value=report_html_path, visible=report_html_path is not None),
725
+ tree_html_content,
726
+ report_html_content
727
+ )
 
 
 
 
 
 
 
 
 
728
 
729
  analyze_btn.click(
730
+ fn=run_pipeline,
731
  inputs=[dna_input, similarity_score, build_ml_tree],
732
  outputs=[
733
  boundary_output, keras_output, ml_tree_output, tree_analysis_output, summary_output,
 
736
  )
737
 
738
  analyze_file_btn.click(
739
+ fn=run_pipeline_from_file,
740
  inputs=[file_input, file_similarity_score, file_build_ml_tree],
741
  outputs=[
742
  boundary_output, keras_output, ml_tree_output, tree_analysis_output, summary_output,