Ver Fonte

feat: 更新数据展示组件宽度设置,支持自适应宽度

zhch158_admin há 1 mês atrás
pai
commit
d14f55a06c
1 ficheiros alterados com 7 adições e 7 exclusões
  1. 7 7
      streamlit_ocr_validator_v1.py

+ 7 - 7
streamlit_ocr_validator_v1.py

@@ -371,7 +371,7 @@ class StreamlitOCRValidator:
                 st.markdown(f'<div class="{container_class}">', unsafe_allow_html=True)
                 edited_table = st.data_editor(
                     filtered_table, 
-                    use_container_width=True, 
+                    width='stretch', 
                     key=f"editor_{i}",
                     height=400 if len(table.columns) > 8 else None
                 )
@@ -383,7 +383,7 @@ class StreamlitOCRValidator:
                 st.markdown(f'<div class="{container_class}">', unsafe_allow_html=True)
                 st.dataframe(
                     filtered_table, 
-                    # use_container_width=True,
+                    # width='stretch',
                     width =400 if len(table.columns) > wide_table_threshold else "stretch"
                 )
                 st.markdown('</div>', unsafe_allow_html=True)
@@ -573,7 +573,7 @@ class StreamlitOCRValidator:
                 )
         
         # 开始批量验证按钮
-        if st.button("🚀 开始批量验证", type="primary", use_container_width=True):
+        if st.button("🚀 开始批量验证", type="primary", width='stretch'):
             self._run_batch_cross_validation(table_mode, similarity_algorithm)
         
         # 显示历史批量验证结果
@@ -935,7 +935,7 @@ class StreamlitOCRValidator:
         # 显示表格
         st.dataframe(
             df_pages,
-            use_container_width=True,
+            width='stretch',
             hide_index=True,
             column_config={
                 "页码": st.column_config.NumberColumn("页码", width="small"),
@@ -1051,7 +1051,7 @@ class StreamlitOCRValidator:
                 
                 st.dataframe(
                     styled_df, 
-                    use_container_width=True,
+                    width='stretch',
                     height=400,
                     hide_index=True,
                     column_config={
@@ -1165,7 +1165,7 @@ class StreamlitOCRValidator:
                             names=list(type_counts.keys()),
                             title="差异类型分布"
                         )
-                        st.plotly_chart(fig_type, use_container_width=True)
+                        st.plotly_chart(fig_type, width='stretch')
                 
                 with col2:
                     # 严重程度分布条形图
@@ -1176,7 +1176,7 @@ class StreamlitOCRValidator:
                         color=list(severity_counts.keys()),
                         color_discrete_map={'高': '#f44336', '中': '#ff9800', '低': '#4caf50'}
                     )
-                    st.plotly_chart(fig_severity, use_container_width=True)
+                    st.plotly_chart(fig_severity, width='stretch')
         
         # 下载选项
         if detailed: