Pytorch-Streamlit
Streamlit, 一个快速构建python应用程序的框架
本文参考
安装Streamlit
1 | pip install streamlit |
使用Streamlit
具体用法可以参考中文开发文档,实际上就是单纯调用api。这里我记录一些我在使用过程中遇到的一些问题。
- Streamlit运行过程
Streamlit在每次运行时,都会从头开始将整个app重新运行一遍(除了那些缓存在cache中的数据) - Streamlit远程运行
Streamlit默认端口为8501,同样可以利用端口转发技术,将远程Streamlit程序显示在当前电脑中。1
ssh -L 8501:127.0.0.1:8501 xuedue@125.216.231.147
- vscode开发Streamlit
在扩展商店中安装multi-command扩展,扩展的settings.json文件中加入实际上就是用一个快捷命令来控制Streamlit的运行,这样不用每次自己手敲输命令。1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16"multiCommand.commands": [
{
"command": "multiCommand.streamlitActiveFile",
"label": "Streamlit: Run Active File",
"description": "Streamlit run active file in active terminal",
"sequence": [
"workbench.action.terminal.focus",
{
"command": "workbench.action.terminal.sendSequence",
"args": {
"text": "streamlit run ${relativeFile}\u000D"
}
}
]
},
],
键入crtl+shift+p,选择Multi command:Execute multi command,再选择Streamlit命令。
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 xuedue!