def _construct_result(self, pred):
        """Construction Label Studio result from data source and prediction values."""
        # get label
        if isinstance(pred, list):
            label = [list(self.parameters.classes)[p] for p in pred]
        else:
            label = list(self.parameters.classes)[pred]
        # get data type, if len(data_types) > 1 take first data type
        data_type = list(self.parameters.data_types)[0]
        # get tag type, if len(tag_types) > 1 take first tag
        tag_type = list(self.parameters.tag_types)[0]
        return {
            "result": [
                {
                    "id": "".join(
                        random.SystemRandom().choice(string.ascii_uppercase + string.ascii_lowercase + string.digits)
                        for _ in range(10)
                    ),
                    "from_name": "tag",
                    "to_name": data_type,
                    "type": tag_type,
                    "value": {tag_type: label if isinstance(label, list) else [label]},
                }
            ]
        }
Construction Label Studio result from data source and prediction values.
src/flash/core/integrations/labelstudio/visualizer.py