根据识别结果来决定识别结果的显示颜色!红色,错误,绿色,正确!
This commit is contained in:
@@ -676,13 +676,21 @@ class FoodClassifierApp:
|
|||||||
)
|
)
|
||||||
result_title_label.pack(fill="x", padx=5, pady=(2, 0))
|
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(
|
result_content_label = ctk.CTkLabel(
|
||||||
info_frame,
|
info_frame,
|
||||||
text=result['predicted_class'],
|
text=result['predicted_class'],
|
||||||
anchor="w",
|
anchor="w",
|
||||||
font=("Arial", 18, "bold"),
|
font=("Arial", 18, "bold"),
|
||||||
text_color="green"
|
text_color=result_color
|
||||||
)
|
)
|
||||||
result_content_label.pack(fill="x", padx=5, pady=(0, 2))
|
result_content_label.pack(fill="x", padx=5, pady=(0, 2))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user