Spaces:
Runtime error
Runtime error
File size: 1,359 Bytes
7865cbb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | import streamlit as st
from visualize import plotSurface
from DecisionTree import predictor
def md_contents():
collapse_content = """
<details>
<summary>Getting started</summary>
<a href="https://mp.weixin.qq.com/s/OFoTbEcvbe-k3Ys-wTStPA">streamlit 极简入门</a>
</details>
<details>
<summary>Additional knowledge</summary>
<a href="https://mp.weixin.qq.com/s/74ehblIzwe4rmCM6K-ynEA">决策树的可视化</a>
</details>
"""
st.title("决策树西瓜挑选器")
st.markdown(collapse_content, unsafe_allow_html=True)
def body():
predictor()
st.markdown("---")
st.write("Source Code")
with st.expander("data.py", expanded=False):
with open("data.py", encoding="UTF-8") as f:
st.code(f.read(), language="python")
with st.expander("DecisionTree.py", expanded=False):
with open("DecisionTree.py", encoding="UTF-8") as f:
st.code(f.read(), language="python")
with st.expander("visualize.py", expanded=False):
with open("visualize.py", encoding="UTF-8") as f:
st.code(f.read(), language="python")
if st.checkbox("decisionTreeViz"):
# viz = decisionTreeViz(model)
# svg = viz.svg()
# svg_write(svg)
ps=plotSurface()
if __name__ == '__main__':
md_contents()
body() |