A applet to use streamlit objectification
Project description
Streamlit 的对象化处理工具
Streamlit-App 通过根据在部署目录自动创建满足 streamlit 多页面要求的 py 脚本的方法,实现了对象化创建 streamlit 服务的功能。
安装
pip install streamlit-app
使用
import streamlit as st
from streamlit_app import Application, StreamlitPage
class MyMainPage(StreamlitPage):
def page_name(self) -> str:
return self.params.get("name")
def draw_page(self) -> None:
st.title("Main Page Title")
st.write("streamlit-app app page test")
class MySubPage(StreamlitPage):
def page_name(self) -> str:
return "test_sub_page"
def draw_page(self) -> None:
st.title("Sub Page Title")
st.write("streamlit-app sub page test")
if __name__ == "__main__":
application = Application()
application.set_main_page(MyMainPage, params={"name": "Main Page Title"})
application.append_page(MySubPage)
application.deploy_and_start()
实例化 StreamlitPage.Application
类,调用 set_main_page()
方法设置主页面,使用 append_page()
方法设置其他页面,在设置完成后,调用 deploy_and_start()
方法部署并启动 Streamlit 服务。
修改记录
0.0.3
- 新增:根据调用栈自动计算组件的唯一键的工具
- 修复:修复不同路径下 py 脚本文件名相同无法正常展示的 Bug
0.0.2
- 新增:支持在初始化 StreamPage 时添加参数,将 StreamPage 的静态方法改为非静态方法
0.0.1:初始化
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
streamlit-app-0.0.3.tar.gz
(6.2 kB
view details)
File details
Details for the file streamlit-app-0.0.3.tar.gz
.
File metadata
- Download URL: streamlit-app-0.0.3.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ec74ae26366aab05bbf272ad366dc14bb4f6d0dde38e3f291f513526a517f8c |
|
MD5 | ee12d005ef80091f29787f83610b0266 |
|
BLAKE2b-256 | 74ab26175fc79bfdcecf4415cca3b49d50eaed511f25709f68686ef4a44c661d |