'''
@Author N.J
@Info 一文学会Stramlit
#安装
Python 3.6.5
pip install streamlit==0.62.0
pip install pandas==1.1.5
启动
E:\500w\streamlit\>C:\Python\Python36-32\Scripts\streamlit run app-streamlit.py
访问
http://127.0.0.1:8501/
'''
import streamlit as st
import pandas as pd
import numpy as np
from PIL import Image
side = ["按钮","线图","图片","数据4","数据5","图片音频视频","分屏","表单"]
st.sidebar.title("主面板")
la = st.sidebar.selectbox("请选择",side)
if la == "按钮":
st.title("按钮")
st.button("点击按钮")
if la == "线图":
#标题
st.title('this is the app title')
#pandas读取数据
df = pd.read_csv('data.txt')
#线图
st.line_chart(df)
if la == "图片":
st.title("图片")
#显示图片
image = Image.open('3.png')
st.image(image, caption='Sunrise by the mountains',use_column_width=True)
st.image(image, caption='Sunrise by the mountains',use_column_width=True)
if la == "数据4":
st.title("此示例使用 Numpy 生成随机样本")
df3 = np.random.randn(10, 20)
st.dataframe(df3)
if la== "数据5":
env=["test1","test2"]
st.sidebar.selectbox("请选择环境",env)
st.title("这是一个简单的页面")
script = ['信息查询','下单']
script_name = st.selectbox("请选择脚本",script)
if script_name == "下单":
st.text_input("请输入名称")
code = st.text_input("请输入编码")
submit = st.button("提交")
if submit:
st.write("提交成功\n")
if la == "图片音频视频":
st.image("kid.jpg")
st.audio("Audio.mp3")
st.video("video.mp4")
if la == "分屏":
left, right = st.beta_columns(2)
# 左半边页面展示部分
with left:
st.header("查看、更新用户信息")
with right:
st.header("编辑、更新用户信息")
if la=="表单":
with st.form("my_form"):
st.write("Inside the form")
slider_val = st.slider("Form slider")
checkbox_val = st.checkbox("Form checkbox")
# Every form must have a submit button.
submitted = st.form_submit_button("Submit")
if submitted:
st.write("slider", slider_val, "checkbox", checkbox_val)
st.write("Outside the form")

kandk522
- 粉丝: 8
最新资源
- 电力系统中基于扩展卡尔曼观测器的无模型预测电流控制仿真分析
- 直驱永磁同步发电机结合超级电容与蓄电池储能的并网控制MATLABSimulink建模及策略分析 直驱永磁同步发电机
- (源码)基于React框架的入门项目.zip
- 机械工程领域基于MATLAB的小波时频图与卷积神经网络在西储大学滚动轴承故障诊断的应用
- (源码)基于C语言AVR单片机的实时天气站控制器.zip
- COMSOL仿真解析:激光烧蚀靶材中的流体传热、水平集与层流研究 详细版
- 基于NARX模型的多变量时间序列预测及其Matlab实现 - 非线性自回归 全面版
- (源码)基于ESP32CAM的物联网人脸识别智能门锁.zip
- 基于MatlabSimulink的MPC模型预测控制车队控制队列系统(3车队列控制+多车扩展)
- (源码)基于LoRa通信协议的Digipeater项目.zip
- Matlab中基于IMM与UKFEKF的三维路径跟踪预测仿真研究
- MATLAB编程专家:代改车辆参数与能源管理策略模型,优化仿真图像,动态控制技术提升汽车性能
- (源码)基于React Native和Dva框架的移动应用模板.zip
- 机器人技术领域中全局路径规划与DWA算法融合实现动态避障的应用研究
- (源码)基于Arduino和Alexa的智能家居自动化系统.zip
- 磁链控制优化新突破:全阶磁链观测器FFO-FOC异步电机无感矢量控制
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


