From 6295ec5c1cdb33027cf833572174bf6e1679aa68 Mon Sep 17 00:00:00 2001 From: zhanghuan <1262329256@qq.com> Date: Wed, 3 Sep 2025 11:45:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E8=AF=86=E5=88=AB=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E6=9D=A5=E5=86=B3=E5=AE=9A=E8=AF=86=E5=88=AB=E7=BB=93?= =?UTF-8?q?=E6=9E=9C=E7=9A=84=E6=98=BE=E7=A4=BA=E9=A2=9C=E8=89=B2=EF=BC=81?= =?UTF-8?q?=E7=BA=A2=E8=89=B2=EF=BC=8C=E9=94=99=E8=AF=AF=EF=BC=8C=E7=BB=BF?= =?UTF-8?q?=E8=89=B2=EF=BC=8C=E6=AD=A3=E7=A1=AE=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classifier/food_classifier_app.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/classifier/food_classifier_app.py b/classifier/food_classifier_app.py index 4d74891..1413c09 100644 --- a/classifier/food_classifier_app.py +++ b/classifier/food_classifier_app.py @@ -676,13 +676,21 @@ class FoodClassifierApp: ) result_title_label.pack(fill="x", padx=5, pady=(2, 0)) - # 识别结果内容(大字体、红色、加粗) + # 识别结果内容(大字体、加粗,颜色根据正确性决定) + is_correct = result.get('is_correct') + if is_correct is True: + result_color = "green" # 识别正确显示绿色 + elif is_correct is False: + result_color = "red" # 识别错误显示红色 + else: + result_color = "orange" # 无法判断显示橙色 + result_content_label = ctk.CTkLabel( info_frame, text=result['predicted_class'], anchor="w", font=("Arial", 18, "bold"), - text_color="green" + text_color=result_color ) result_content_label.pack(fill="x", padx=5, pady=(0, 2))