From 1af481f238ca96db72e835af3d8a8e2f4a6021cf Mon Sep 17 00:00:00 2001 From: Abubakar Abid Date: Mon, 12 Jul 2021 12:59:58 -0500 Subject: [PATCH] fixed type checking for interpretation --- gradio/interpretation.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gradio/interpretation.py b/gradio/interpretation.py index fab0a88ed8..278aac0135 100644 --- a/gradio/interpretation.py +++ b/gradio/interpretation.py @@ -13,7 +13,7 @@ def quantify_difference_in_label(interface, original_output, perturbed_output): post_original_output = output_component.postprocess(original_output[0]) post_perturbed_output = output_component.postprocess(perturbed_output[0]) - if type(output_component) == Label: + if isinstance(output_component, Label): original_label = post_original_output["label"] perturbed_label = post_perturbed_output["label"] @@ -26,7 +26,7 @@ def quantify_difference_in_label(interface, original_output, perturbed_output): score = diff(original_label, perturbed_label) return score - elif type(output_component) == Textbox: + elif isinstance(output_component, Textbox): score = diff(post_original_output, post_perturbed_output) return score