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))