def get(self, group=None, task=None): """ Retrieves the list of available tasks, their arguments and valid values for those arguments. ** Request ** .. sourcecode:: http GET /tasks ** Response ** .. sourcecode:: http HTTP/1.1 200 OK { "img": { "deskew": {}, "dewarp": {}, "rgb_to_gray": {} }, "binarize": { "nlbin": { "border": "float", "escale": "float", "high": [ 0, 100 ], "low": [ 0, 100 ], }, "otsu": {}, "sauvola": { "factor": [ 0.0, 1.0 ], "whsize": "int" } }, "segmentation": { "kraken": {}, "tesseract": {} }, "ocr": { "kraken": { "model": [ "fraktur.pyrnn.gz", "default", "teubner" ] }, "tesseract": { "extended": [ false, true ], "languages": [ "chr", "chi_tra", "ita_old", "ceb", ] } }, "postprocessing": { "spell_check": { "filter_punctuation": [ true, false ], "language": [ "latin", "polytonic_greek" ] } }, "output": { "metadata": { "metadata": "file", "validate": [ true, false ] }, "tei2hocr": {}, "tei2simplexml": {}, "tei2txt": {} } } It is also possible to retrieve only a subset of task definitions by adding to the request a task group and/or the task name: ** Request ** .. sourcecode:: http GET /tasks/segmentation ** Response ** .. sourcecode:: http HTTP/1.1 200 OK { "segmentation": { "kraken": {}, "tesseract": {} } } Currently there are 4 different argument types: * "int": An integer * "float": A float (floats serialized to integers, i.e. 1.0 to 1 are also accepted) * "str": An UTF-8 encoded string * "file": A file on the storage medium, referenced by its URL Finally there are lists of valid argument values where one or more values out of the list may be picked and value ranges """ log.debug('Routing to tasks with group {}, method {}'.format( group, task)) tasks = SimpleBatch.get_available_tasks() if group and group not in tasks: return {'message': 'Unknown group {}'.format(group)}, 404 elif task and task not in tasks[group]: return {'message': 'Unknown task {}'.format(task)}, 404 if group: tasks = {group: tasks[group]} if task: tasks = {group: {task: tasks[group][task]}} return tasks, 200
def get(self, group=None, task=None): """ Retrieves the list of available tasks, their arguments and valid values for those arguments. ** Request ** .. sourcecode:: http GET /tasks ** Response ** .. sourcecode:: http HTTP/1.1 200 OK { "img": { "deskew": {}, "dewarp": {}, "rgb_to_gray": {} }, "binarize": { "nlbin": { "border": "float", "escale": "float", "high": [ 0, 100 ], "low": [ 0, 100 ], }, "otsu": {}, "sauvola": { "factor": [ 0.0, 1.0 ], "whsize": "int" } }, "segmentation": { "kraken": {}, "tesseract": {} }, "ocr": { "kraken": { "model": [ "fraktur.pyrnn.gz", "default", "teubner" ] }, "tesseract": { "extended": [ false, true ], "languages": [ "chr", "chi_tra", "ita_old", "ceb", ] } }, "postprocessing": { "spell_check": { "filter_punctuation": [ true, false ], "language": [ "latin", "polytonic_greek" ] } }, "output": { "metadata": { "metadata": "file", "validate": [ true, false ] }, "tei2hocr": {}, "tei2simplexml": {}, "tei2txt": {} } } It is also possible to retrieve only a subset of task definitions by adding to the request a task group and/or the task name: ** Request ** .. sourcecode:: http GET /tasks/segmentation ** Response ** .. sourcecode:: http HTTP/1.1 200 OK { "segmentation": { "kraken": {}, "tesseract": {} } } Currently there are 4 different argument types: * "int": An integer * "float": A float (floats serialized to integers, i.e. 1.0 to 1 are also accepted) * "str": An UTF-8 encoded string * "file": A file on the storage medium, referenced by its URL Finally there are lists of valid argument values where one or more values out of the list may be picked and value ranges """ log.debug('Routing to tasks with group {}, method {}'.format(group, task)) tasks = SimpleBatch.get_available_tasks() if group and group not in tasks: return {'message': 'Unknown group {}'.format(group)}, 404 elif task and task not in tasks[group]: return {'message': 'Unknown task {}'.format(task)}, 404 if group: tasks = {group: tasks[group]} if task: tasks = {group: {task: tasks[group][task]}} return tasks, 200