【streamlit】——将markdown文件,以网页形式打开

Published on
21
1、python安装依赖

pip install streamlit

2、创建应用入口
# quickStart.py
import streamlit as st

docs_file = "./docs.md"

def read_markdown_file(filepath):
    with open(filepath, 'r', encoding='utf-8') as f:
        return f.read()

text = read_markdown_file(docs_file)
st.markdown(text, unsafe_allow_html=True)

3、执行

python -m streamlit run quickStart.py --server.port 8000

4、访问

http://localhost:8000/