You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
1.1 KiB
25 lines
1.1 KiB
import streamlit as st
|
|
|
|
|
|
def show_user_info_form():
|
|
with st.sidebar:
|
|
st.header("个人信息")
|
|
with st.form("user_info_form"):
|
|
gender = st.selectbox("性别", ["女", "男", "其他"])
|
|
age = st.slider("年龄", 10, 80, 25)
|
|
height = st.number_input("身高(cm)", 100, 250, 165)
|
|
weight = st.number_input("体重(kg)", 30, 150, 55)
|
|
skin_tone = st.selectbox("肤色", ["白皙", "自然", "小麦色", "深色"])
|
|
style_preference = st.multiselect("风格偏好", ["休闲", "正式", "运动", "甜美", "复古", "街头", "商务"])
|
|
submitted = st.form_submit_button("保存信息")
|
|
|
|
if submitted:
|
|
st.session_state.user_info = {
|
|
"gender": gender,
|
|
"age": age,
|
|
"height": height,
|
|
"weight": weight,
|
|
"skin_tone": skin_tone,
|
|
"style_preference": style_preference
|
|
}
|
|
st.success("个人信息已保存!") |