LethallyHealthy commited on
Commit
ed7fdc5
·
1 Parent(s): a0ed761

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -42,16 +42,17 @@ with st.sidebar:
42
  data["MoSold"] = st.slider("Month Sold:", 1,12)
43
 
44
  from streamlit import components
 
 
 
45
 
46
  #The button
47
  if st.button("Calculate Your House Price!"):
48
  results = predictor.make_a_prediction(data)
49
  st.write('{0:.2f}'.format(results[0]))
50
- c = st.container()
51
  objects = predictor.create_shap_models(data)
52
  for obj in objects:
53
- raw_html = obj._repr_html_()
54
- components.v1.html(raw_html)
55
 
56
 
57
 
 
42
  data["MoSold"] = st.slider("Month Sold:", 1,12)
43
 
44
  from streamlit import components
45
+ def st_shap(plot, height=None):
46
+ shap_html = f"<head>{shap.getjs()}</head><body>{plot.html()}</body>"
47
+ components.html(shap_html, height=height)
48
 
49
  #The button
50
  if st.button("Calculate Your House Price!"):
51
  results = predictor.make_a_prediction(data)
52
  st.write('{0:.2f}'.format(results[0]))
 
53
  objects = predictor.create_shap_models(data)
54
  for obj in objects:
55
+ st_shap(obj)
 
56
 
57
 
58