// ExitStack lets us use several file context managers simultaneous
with ExitStack() as stack:
files = [stack.enter_context(s.get_filename()) for s in stims]
fps = [stack.enter_context(open(f, "rb")) for f in files]
tags = self.tagger.tag_images(fps, select_classes=self.select_classes)
extracted = []
After Change
extracted = []
for i, res in enumerate(tags["outputs"]):
data = res["data"]["concepts"]
concepts = []
values = []
for d in data:
concepts.append(d["name"])
values.append(d["value"])
extracted.append(ExtractorResult([values], stims[i],
self, features=concepts))