From 6959951dd03e9f8e707c35d7906c910e2b99cb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=A7?= Date: Thu, 15 Jan 2026 21:51:49 +0800 Subject: [PATCH] =?UTF-8?q?feat(streamlit):=20=E6=B7=BB=E5=8A=A0=E9=87=8D?= =?UTF-8?q?=E7=BD=AE=E6=8C=89=E9=92=AE=E4=BB=A5=E5=87=86=E5=A4=87=E4=B8=8B?= =?UTF-8?q?=E4=B8=80=E6=AC=A1=E5=88=86=E6=9E=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在单条分析和批量分析界面添加重置按钮,用于清除当前状态并准备下一次测试 --- .gitignore | 2 +- email_data.csv | 15 +++++++++++++++ models/lightgbm.joblib | Bin 921150 -> 921150 bytes src/streamlit_app.py | 28 ++++++++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 email_data.csv diff --git a/.gitignore b/.gitignore index 76e7681..e53edca 100644 --- a/.gitignore +++ b/.gitignore @@ -28,7 +28,7 @@ logs/ *.xlsx *.parquet !data/spam.csv - +!email_data.csv # Streamlit .streamlit/ diff --git a/email_data.csv b/email_data.csv new file mode 100644 index 0000000..3241756 --- /dev/null +++ b/email_data.csv @@ -0,0 +1,15 @@ +text +"晚上一起吃饭吗?老地方见,我六点下班" +"恭喜您获得1000元购物券!点击链接领取:http://prize123.com" +"妈,我晚上加班,不用等我吃饭了" +"您的快递已放在小区门口快递柜,取件码是3456" +"限时特惠!新款手机直降1000元,立即抢购:http://buyphone.com" +"明天下午开会,记得带好项目报告" +"信用卡账单已出,本期应还款项为1258.36元,还款日25号" +"免费领取最新款平板电脑!回复YES即可参与抽奖" +"爸,我到北京了,一切顺利,不用担心" +"双十一预售开启!全场五折起,快来选购:http://11.11.com" +"会议改到明天上午十点,地点不变" +"您的话费余额不足,请及时充值以保证正常使用" +"恭喜您成为幸运用户!点击链接领取iPhone14:http://gift888.com" +"晚上看电影吗?新上映的那部听说不错" diff --git a/models/lightgbm.joblib b/models/lightgbm.joblib index 5e7d2d082cb0c3d58cca5e7b45899134fbc82f36..0311ee4b7ede5b8a8ea3b827328bc9ac4ac04e7c 100644 GIT binary patch delta 72 zcmdlt$70_ci-s+X_pI3tJZZWR#MJ)8nh}UWG&2yh05K~NvjH(X5OV-AClGT1F*gwN LY=2_S8+8c)tBW7# delta 72 zcmdlt$70_ci-s+X_pI3z9;r;Z&)ELN8ibjEm>Gy!fS47C*?^cGh&h0m6NtHhm>Y + """, unsafe_allow_html=True) + + if st.button("🔄 准备下一条分析", use_container_width=True): + # 重置状态,清空输入框并重新运行应用 + st.session_state.pop("single_result", None) # 如果有存储结果的状态,清除它 + # 使用空的占位符触发界面重置 + st.empty() + # 重新运行应用以确保完全重置 + st.experimental_rerun() + except Exception as e: st.markdown("""
@@ -525,6 +538,21 @@ with col2: use_container_width=True ) + # 添加重置按钮,准备下一次测试 + st.markdown(""" +
+ """, unsafe_allow_html=True) + + if st.button("🔄 准备下一次测试", use_container_width=True): + # 重置状态,清除上传文件并重置所有相关状态 + st.session_state.pop("batch_results", None) # 如果有存储结果的状态,清除它 + uploaded_file = None # 清除上传文件引用 + # 使用空的占位符触发界面重置 + st.empty() + # 重新运行应用以确保完全重置 + st.experimental_rerun() + + except Exception as e: st.markdown("""