更改布局为 3:1

This commit is contained in:
leo
2024-03-07 13:56:31 +08:00
parent 034ad2a3f1
commit 5bdd7007c7

47
main.py
View File

@@ -18,6 +18,7 @@ PAGE_TITLE = "training data configer"
st.set_page_config( st.set_page_config(
page_title=PAGE_TITLE, page_title=PAGE_TITLE,
page_icon="🧊", page_icon="🧊",
layout="wide",
initial_sidebar_state="expanded", initial_sidebar_state="expanded",
) )
@@ -44,6 +45,7 @@ df = pd.DataFrame(data=st.session_state.data_table)
data_frame_container = st.container() data_frame_container = st.container()
config_container = st.container() config_container = st.container()
left_col, right_col = st.columns([3, 1])
def train(): def train():
@@ -67,14 +69,14 @@ def update_config(*args, **kwargs):
st.session_state.configs['mode'] = st.session_state.mode st.session_state.configs['mode'] = st.session_state.mode
with data_frame_container: with left_col:
edited_df = st.data_editor( edited_df = st.data_editor(
df, key="edited_info", df, key="edited_info",
height=600, height=600,
hide_index=True, hide_index=True,
use_container_width=True, use_container_width=True,
on_change=update_handler, on_change=update_handler,
column_order=('id', 'year', 'census_batch', 'id_code', 'precision', 'is_train', 'is_validation'), column_order=('id', 'year', 'census_batch', 'id_code', 'precision', 'is_train', 'is_validation', 'ann_file', 'img_prefix'),
column_config={ column_config={
"year": st.column_config.NumberColumn("年份", format="%d", ), "year": st.column_config.NumberColumn("年份", format="%d", ),
'census_batch': "普查批次", 'census_batch': "普查批次",
@@ -82,31 +84,26 @@ with data_frame_container:
'precision': "精度", 'precision': "精度",
'is_train': "是否是训练集", 'is_train': "是否是训练集",
'is_validation': "是否是验证集", 'is_validation': "是否是验证集",
'ann_file': "path",
'ann_file_lbs': "lbs_path",
}) })
# col1, col2, col3, col4, col5 = st.columns(5)
with right_col:
col1, col2, col3, col4, col5 = st.columns(5) st.slider(label='evolve_r', key='evolve_r',
with config_container: min_value=0.0, max_value=0.5, step=0.01,
st.divider() on_change=update_config)
st.selectbox(label='n_trail', key='n_trail',
with col1: options=(i for i in range(10, 51, 10)))
st.slider(label='evolve_r', key='evolve_r', st.selectbox(label='n_epoch', key='n_epoch',
min_value=0.0, max_value=0.5, step=0.01, options=(i for i in range(1, 6)))
on_change=update_config) st.selectbox(label='ckpt_path', key='ckpt_path',
with col2: options=(os.listdir(BASE_CKPT_DIR)))
st.selectbox(label='n_trail', key='n_trail', st.selectbox(label='mode', key='mode',
options=(i for i in range(10, 51, 10))) format_func=lambda x: RUN_MODE[x],
st.selectbox(label='n_epoch', key='n_epoch', options=RUN_MODE,
options=(i for i in range(1, 6))) on_change=update_config)
with col3: st.json(st.session_state.configs)
st.selectbox(label='ckpt_path', key='ckpt_path',
options=(os.listdir(BASE_CKPT_DIR)))
with col4:
st.selectbox(label='mode', key='mode',
format_func=lambda x: RUN_MODE[x],
options=RUN_MODE,
on_change=update_config)
with col5:
st.json(st.session_state.configs)
st.divider() st.divider()
st.button("启动", on_click=train) st.button("启动", on_click=train)