From 5bdd7007c70cdd349a689d0422f98dbfb80aebc0 Mon Sep 17 00:00:00 2001 From: leo Date: Thu, 7 Mar 2024 13:56:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=B8=83=E5=B1=80=E4=B8=BA?= =?UTF-8?q?=203:1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 47 ++++++++++++++++++++++------------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/main.py b/main.py index de376e7..09672d3 100644 --- a/main.py +++ b/main.py @@ -18,6 +18,7 @@ PAGE_TITLE = "training data configer" st.set_page_config( page_title=PAGE_TITLE, page_icon="🧊", + layout="wide", initial_sidebar_state="expanded", ) @@ -44,6 +45,7 @@ df = pd.DataFrame(data=st.session_state.data_table) data_frame_container = st.container() config_container = st.container() +left_col, right_col = st.columns([3, 1]) def train(): @@ -67,14 +69,14 @@ def update_config(*args, **kwargs): st.session_state.configs['mode'] = st.session_state.mode -with data_frame_container: +with left_col: edited_df = st.data_editor( df, key="edited_info", height=600, hide_index=True, use_container_width=True, 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={ "year": st.column_config.NumberColumn("年份", format="%d 年", ), 'census_batch': "普查批次", @@ -82,31 +84,26 @@ with data_frame_container: 'precision': "精度", 'is_train': "是否是训练集", '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) -with config_container: - st.divider() - - with col1: - st.slider(label='evolve_r', key='evolve_r', - min_value=0.0, max_value=0.5, step=0.01, - on_change=update_config) - with col2: - st.selectbox(label='n_trail', key='n_trail', - options=(i for i in range(10, 51, 10))) - st.selectbox(label='n_epoch', key='n_epoch', - options=(i for i in range(1, 6))) - with col3: - 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.slider(label='evolve_r', key='evolve_r', + min_value=0.0, max_value=0.5, step=0.01, + on_change=update_config) + st.selectbox(label='n_trail', key='n_trail', + options=(i for i in range(10, 51, 10))) + st.selectbox(label='n_epoch', key='n_epoch', + options=(i for i in range(1, 6))) + st.selectbox(label='ckpt_path', key='ckpt_path', + options=(os.listdir(BASE_CKPT_DIR))) + st.selectbox(label='mode', key='mode', + format_func=lambda x: RUN_MODE[x], + options=RUN_MODE, + on_change=update_config) + st.json(st.session_state.configs) st.divider() st.button("启动", on_click=train)