Severian commited on
Commit
905b3e5
·
verified ·
1 Parent(s): 91d3b85

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -14
app.py CHANGED
@@ -947,21 +947,27 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="cyan")) a
947
  diag = go.Figure(layout={"title": "Error processing data"})
948
  entropy = go.Figure(layout={"title": "Error processing data"})
949
 
950
- primary_info = f"""
951
- <b>Primary:</b> {primary_row['filepath']}<br>
952
- <b>Species:</b> {primary_row['source']}<br>
953
- <b>Label:</b> {primary_row.get('label', 'N/A')}<br>
954
- <b>Alpha:</b> {primary_cmt['alpha']:.4f}<br>
955
- <b>SRL:</b> {primary_cmt['srl']:.4f}
956
- """ if primary_cmt else ""
 
 
 
957
 
958
- neighbor_info = f"""
959
- <b>Neighbor:</b> {neighbor_row['filepath'] if neighbor_row is not None else 'N/A'}<br>
960
- <b>Species:</b> {neighbor_row['source'] if neighbor_row is not None else 'N/A'}<br>
961
- <b>Label:</b> {neighbor_row.get('label', 'N/A') if neighbor_row is not None else 'N/A'}<br>
962
- <b>Alpha:</b> {neighbor_cmt['alpha']:.4f if neighbor_cmt else 0}<br>
963
- <b>SRL:</b> {neighbor_cmt['srl']:.4f if neighbor_cmt else 0}
964
- """ if neighbor_cmt else ""
 
 
 
965
 
966
  return dual_holo, diag, entropy, primary_info, neighbor_info
967
 
 
947
  diag = go.Figure(layout={"title": "Error processing data"})
948
  entropy = go.Figure(layout={"title": "Error processing data"})
949
 
950
+ if primary_cmt:
951
+ primary_info = f"""
952
+ <b>Primary:</b> {primary_row['filepath']}<br>
953
+ <b>Species:</b> {primary_row['source']}<br>
954
+ <b>Label:</b> {primary_row.get('label', 'N/A')}<br>
955
+ <b>Alpha:</b> {primary_cmt['alpha']:.4f}<br>
956
+ <b>SRL:</b> {primary_cmt['srl']:.4f}
957
+ """
958
+ else:
959
+ primary_info = ""
960
 
961
+ if neighbor_cmt and neighbor_row is not None:
962
+ neighbor_info = f"""
963
+ <b>Neighbor:</b> {neighbor_row['filepath']}<br>
964
+ <b>Species:</b> {neighbor_row['source']}<br>
965
+ <b>Label:</b> {neighbor_row.get('label', 'N/A')}<br>
966
+ <b>Alpha:</b> {neighbor_cmt['alpha']:.4f}<br>
967
+ <b>SRL:</b> {neighbor_cmt['srl']:.4f}
968
+ """
969
+ else:
970
+ neighbor_info = ""
971
 
972
  return dual_holo, diag, entropy, primary_info, neighbor_info
973