Python maxfw.core.MAX_API.model() Examples

The following are 4 code examples of maxfw.core.MAX_API.model(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module maxfw.core.MAX_API , or try the search function .
Example #1
Source File: predict.py    From MAX-Named-Entity-Tagger with Apache License 2.0 5 votes vote down vote up
def get(self):
        '''Return the list of labels that can be predicted by the model'''
        result = {}
        result['labels'] = [{'id': l[0], 'name': l[1], 'description': tag_desc[l[1]] if l[1] in tag_desc else ''}
                            for l in model_wrapper.id_to_tag.items()]  # noqa (E741 ambiguous variable name 'l')
        result['count'] = len(model_wrapper.id_to_tag)
        return result

# === Predict API 
Example #2
Source File: predict.py    From MAX-Image-Segmenter with Apache License 2.0 5 votes vote down vote up
def get(self):
        """Return the list of labels that can be predicted by the model"""

        labels = [{"id": 0, "name": 'background'},
                  {"id": 1, "name": 'aeroplane'},
                  {"id": 2, "name": 'bicycle'},
                  {"id": 3, "name": 'bird'},
                  {"id": 4, "name": 'boat'},
                  {"id": 5, "name": 'bottle'},
                  {"id": 6, "name": 'bus'},
                  {"id": 7, "name": 'car'},
                  {"id": 8, "name": 'cat'},
                  {"id": 9, "name": 'chair'},
                  {"id": 10, "name": 'cow'},
                  {"id": 11, "name": 'diningtable'},
                  {"id": 12, "name": 'dog'},
                  {"id": 13, "name": 'horse'},
                  {"id": 14, "name": 'motorbike'},
                  {"id": 15, "name": 'person'},
                  {"id": 16, "name": 'pottedplant'},
                  {"id": 17, "name": 'sheep'},
                  {"id": 18, "name": 'sofa'},
                  {"id": 19, "name": 'train'},
                  {"id": 20, "name": 'tv'}]

        return labels 
Example #3
Source File: predict.py    From MAX-Toxic-Comment-Classifier with Apache License 2.0 5 votes vote down vote up
def get(self):
        '''Return the list of labels that can be predicted by the model.'''
        result = dict()
        result['labels'] = {label: label_description[label] for label in label_description}
        result['count'] = len(label_description.keys())
        return result 
Example #4
Source File: predict.py    From MAX-Object-Detector with Apache License 2.0 5 votes vote down vote up
def get(self):
        """Return the list of labels that can be predicted by the model"""
        return {
            'labels': model_wrapper.categories,
            'count': len(model_wrapper.categories)
        }