From dd0a0b63c69df641b4f1c4b05cd40b97fce43ddc Mon Sep 17 00:00:00 2001 From: David Strand Date: Wed, 18 Dec 2024 19:33:31 +0800 Subject: [PATCH] boolean updated --- classifiers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/classifiers.py b/classifiers.py index c581146..dda4bb0 100644 --- a/classifiers.py +++ b/classifiers.py @@ -40,7 +40,7 @@ class HFClassify: } RETURN_TYPES = ("FLOAT", "INT", "BOOL") # Added BOOL for the new boolean output - RETURN_NAMES = ("raw_score", "rounded_score", "is_above_threshold") # Added name for the boolean output + RETURN_NAMES = ("raw_score", "rounded_score", "boolean") # Added name for the boolean output FUNCTION = "classify" def classify(self, hf_classifier_model, image_to_classify, target_label): @@ -61,8 +61,8 @@ class HFClassify: # Round the score to 0 or 1 rounded_score = int(round(score)) - # Determine if the score is above the threshold of 0.5 - is_above_threshold = score > 0.5 + # Convert to boolean + boolean = bool(rounded_score) # Return the raw score, rounded score, and the boolean indicating if above threshold - return (score, rounded_score, is_above_threshold) + return (score, rounded_score, boolean)