File tree Expand file tree Collapse file tree 4 files changed +10
-10
lines changed
Expand file tree Collapse file tree 4 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -103,8 +103,8 @@ def depthgenerator():
103103 classifier_1 = "ca.mcgill.a11y.image.preprocessor.contentCategoriser"
104104 if classifier_1 in preprocess_output :
105105 classifier_1_output = preprocess_output [classifier_1 ]
106- classifier_1_label = classifier_1_output . get ( "category" , "" )
107- if classifier_1_label != "photograph" :
106+ categoriser_tags = classifier_1_output [ "categories" ]
107+ if not categoriser_tags [ "photo" ] :
108108 logging .info ("Not photograph content. Skipping..." )
109109 return "" , 204
110110 else :
Original file line number Diff line number Diff line change @@ -139,9 +139,8 @@ def categorise():
139139 if content_classifier in preprocess_output :
140140 content_classifier_output = \
141141 preprocess_output [content_classifier ]
142- content_label = \
143- content_classifier_output ["category" ]
144- if content_label == "photograph" :
142+ categoriser_tags = content_classifier_output ["categories" ]
143+ if categoriser_tags ["photo" ]:
145144 source = content ["graphic" ]
146145 image_b64 = source .split ("," )[1 ]
147146 binary = base64 .b64decode (image_b64 )
Original file line number Diff line number Diff line change @@ -161,8 +161,9 @@ def segment():
161161 # if the architecture is modified appropriately
162162 if classifier_1 in preprocess_output :
163163 classifier_1_output = preprocess_output [classifier_1 ]
164- classifier_1_label = classifier_1_output ["category" ]
165- if classifier_1_label != "photograph" :
164+ categoriser_tags = classifier_1_output ["categories" ]
165+
166+ if not categoriser_tags ["photo" ]:
166167 logging .info ("Not photograph content. Skipping..." )
167168 return "" , 204
168169 if classifier_2 in preprocess_output :
Original file line number Diff line number Diff line change @@ -137,9 +137,9 @@ def categorise():
137137 if content_classifier in preprocess_output :
138138 content_classifier_output = \
139139 preprocess_output [content_classifier ]
140- content_label = \
141- content_classifier_output ["category " ]
142- if content_label == "photograph" :
140+ content_tags = \
141+ content_classifier_output ["categories " ]
142+ if content_tags [ "photo" ] :
143143 source = content ["graphic" ]
144144 image_b64 = source .split ("," )[1 ]
145145 binary = base64 .b64decode (image_b64 )
You can’t perform that action at this time.
0 commit comments