|
|
@@ -1025,7 +1025,7 @@ def main():
|
|
|
st.write("**详细信息:**", stats['tool_info'])
|
|
|
|
|
|
# 其余标签页保持不变...
|
|
|
- tab1, tab2, tab3, tab4 = st.tabs(["📄 内容校验", "📄 VLM预校验识别结果", "📊 表格分析", "📈 数据统计"])
|
|
|
+ tab1, tab2, tab3 = st.tabs(["📄 内容校验", "📄 VLM预校验识别结果", "📊 表格分析"])
|
|
|
|
|
|
with tab1:
|
|
|
validator.create_compact_layout(config)
|
|
|
@@ -1063,57 +1063,41 @@ def main():
|
|
|
st.header("📊 表格数据分析")
|
|
|
|
|
|
if validator.md_content and '<table' in validator.md_content.lower():
|
|
|
- col1, col2 = st.columns([2, 1])
|
|
|
+ st.subheader("🔍 表格数据预览")
|
|
|
+ validator.display_html_table_as_dataframe(validator.md_content)
|
|
|
|
|
|
- with col1:
|
|
|
- st.subheader("🔍 表格数据预览")
|
|
|
- validator.display_html_table_as_dataframe(validator.md_content)
|
|
|
-
|
|
|
- with col2:
|
|
|
- st.subheader("⚙️ 表格操作")
|
|
|
-
|
|
|
- if st.button("📥 导出表格数据", type="primary"):
|
|
|
- tables = parse_html_tables(validator.md_content)
|
|
|
- if tables:
|
|
|
- output = export_tables_to_excel(tables)
|
|
|
- st.download_button(
|
|
|
- label="📥 下载Excel文件",
|
|
|
- data=output.getvalue(),
|
|
|
- file_name=f"ocr_tables_{validator.current_source_config['ocr_tool']}.xlsx",
|
|
|
- mime="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
|
- )
|
|
|
else:
|
|
|
st.info("当前OCR结果中没有检测到表格数据")
|
|
|
|
|
|
- with tab4:
|
|
|
- # 数据统计页面 - 保持原有逻辑
|
|
|
- st.header("📈 OCR数据统计")
|
|
|
+ # with tab4:
|
|
|
+ # # 数据统计页面 - 保持原有逻辑
|
|
|
+ # st.header("📈 OCR数据统计")
|
|
|
|
|
|
- # 添加数据源特定的统计信息
|
|
|
- if validator.current_source_config:
|
|
|
- st.subheader(f"📊 {get_data_source_display_name(validator.current_source_config)} - 统计信息")
|
|
|
+ # # 添加数据源特定的统计信息
|
|
|
+ # if validator.current_source_config:
|
|
|
+ # st.subheader(f"📊 {get_data_source_display_name(validator.current_source_config)} - 统计信息")
|
|
|
|
|
|
- if stats['categories']:
|
|
|
- st.subheader("📊 类别分布")
|
|
|
- fig_pie = px.pie(
|
|
|
- values=list(stats['categories'].values()),
|
|
|
- names=list(stats['categories'].keys()),
|
|
|
- title="文本类别分布"
|
|
|
- )
|
|
|
- st.plotly_chart(fig_pie, use_container_width=True)
|
|
|
+ # if stats['categories']:
|
|
|
+ # st.subheader("📊 类别分布")
|
|
|
+ # fig_pie = px.pie(
|
|
|
+ # values=list(stats['categories'].values()),
|
|
|
+ # names=list(stats['categories'].keys()),
|
|
|
+ # title="文本类别分布"
|
|
|
+ # )
|
|
|
+ # st.plotly_chart(fig_pie, use_container_width=True)
|
|
|
|
|
|
- # 错误率分析
|
|
|
- st.subheader("📈 质量分析")
|
|
|
- accuracy_data = {
|
|
|
- '状态': ['正确', '错误'],
|
|
|
- '数量': [stats['clickable_texts'] - stats['marked_errors'], stats['marked_errors']]
|
|
|
- }
|
|
|
+ # # 错误率分析
|
|
|
+ # st.subheader("📈 质量分析")
|
|
|
+ # accuracy_data = {
|
|
|
+ # '状态': ['正确', '错误'],
|
|
|
+ # '数量': [stats['clickable_texts'] - stats['marked_errors'], stats['marked_errors']]
|
|
|
+ # }
|
|
|
|
|
|
- fig_bar = px.bar(
|
|
|
- accuracy_data, x='状态', y='数量', title="识别质量分布",
|
|
|
- color='状态', color_discrete_map={'正确': 'green', '错误': 'red'}
|
|
|
- )
|
|
|
- st.plotly_chart(fig_bar, use_container_width=True)
|
|
|
+ # fig_bar = px.bar(
|
|
|
+ # accuracy_data, x='状态', y='数量', title="识别质量分布",
|
|
|
+ # color='状态', color_discrete_map={'正确': 'green', '错误': 'red'}
|
|
|
+ # )
|
|
|
+ # st.plotly_chart(fig_bar, use_container_width=True)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
main()
|