Download app.py from watchman/streamlit: direct link, hf CLI and curl.
- Browser
- Download file 942 Bytes
-
https://huggingface.co/spaces/watchman/streamlit/resolve/main/app.py
- Command line
-
hf download hf://spaces/watchman/streamlit/app.py
-
curl -L -o app.py https://huggingface.co/spaces/watchman/streamlit/resolve/main/app.py
942 Bytes
| import numpy as np | |
| import pandas as pd | |
| import streamlit as st | |
| # markdown | |
| st.markdown('Streamlit Demo云申') | |
| # 设置网页标题 | |
| st.title('一个傻瓜式构建可视化 web的 Python 神器 -- streamlit') | |
| # 展示一级标题 | |
| st.header('1. 安装') | |
| st.text('和安装其他包一样,安装 streamlit 非常简单,一条命令即可') | |
| code1 = '''pip3 install streamlit''' | |
| st.code(code1, language='bash') | |
| # 展示一级标题 | |
| st.header('2. 使用') | |
| # 展示二级标题 | |
| st.subheader('2.1 生成 Markdown 文档') | |
| # 纯文本 | |
| st.text('导入 streamlit 后,就可以直接使用 st.markdown() 初始化') | |
| # 展示代码,有高亮效果 | |
| code2 = '''import streamlit as st | |
| st.markdown('Streamlit Demo')''' | |
| st.code(code2, language='python') | |
| df = pd.DataFrame( | |
| np.random.randn(10, 5), | |
| columns=('第%d列' % (i + 1) for i in range(5)) | |
| ) | |
| # st.table(df.style.highlight_max(axis=0)) | |
| st.dataframe(df.style.highlight_max(axis=0)) | |