hlnicholls commited on
Commit
9ccc625
1 Parent(s): f83ec42

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -5,7 +5,7 @@ import pandas as pd
5
  import sklearn
6
  import xgboost
7
  import shap
8
- import streamlit.components.v1 as components
9
  seed=42
10
 
11
  data = pd.read_csv("annotations_dataset.csv")
@@ -70,7 +70,6 @@ if len(gene_list) > 1:
70
  summary_plot = shap.summary_plot(shap_values, df, show=False)
71
  st.caption("SHAP Summary Plot of All Input Genes")
72
  st.pyplot(fig=summary_plot)
73
- #components.html(summary_plot, scrolling = True)
74
 
75
  else:
76
  pass
@@ -80,7 +79,8 @@ input_gene = st.text_input("Input individual HGNC gene:")
80
  df2 = df_total[df_total.index == input_gene]
81
  st.dataframe(df2)
82
  df2.drop(columns='XGB_Score', inplace=True)
83
- if len(input_gene) == 1:
 
84
  shap_values = explainer.shap_values(df2)
85
  shap.initjs()
86
  force_plot = shap.force_plot(
@@ -88,7 +88,6 @@ if len(input_gene) == 1:
88
  shap_values.values,
89
  df2,
90
  show=False)
91
- #components.html(force_plot, scrolling = True)
92
  st.pyplot(fig=force_plot)
93
  else:
94
  pass
 
5
  import sklearn
6
  import xgboost
7
  import shap
8
+ st.set_option('deprecation.showPyplotGlobalUse', False)
9
  seed=42
10
 
11
  data = pd.read_csv("annotations_dataset.csv")
 
70
  summary_plot = shap.summary_plot(shap_values, df, show=False)
71
  st.caption("SHAP Summary Plot of All Input Genes")
72
  st.pyplot(fig=summary_plot)
 
73
 
74
  else:
75
  pass
 
79
  df2 = df_total[df_total.index == input_gene]
80
  st.dataframe(df2)
81
  df2.drop(columns='XGB_Score', inplace=True)
82
+
83
+ if input_gene:
84
  shap_values = explainer.shap_values(df2)
85
  shap.initjs()
86
  force_plot = shap.force_plot(
 
88
  shap_values.values,
89
  df2,
90
  show=False)
 
91
  st.pyplot(fig=force_plot)
92
  else:
93
  pass