问题描述
当使用推理架构为我的AzureML终结点自动生成swagger文档(如详细的here和here)时,我看到它在我的input_sample周围创建了一个包装器。有没有办法 不能将输入内容包装在这个“数据”包装材料中?
这是我的score.py的样子:
input_sample = {
"id": 123,"language": "en"
"items": [{
"item": 1,"desc": "desc"
}]
}
output_sample = [{'prediction': 'true','predictionConfidence': 0.8279970776764844}]
@input_schema('data',StandardPythonParameterType(input_sample))
@output_schema(StandardPythonParameterType(output_sample))
def run(data):
"""
{
data: { --> DON'T WANT this "data" wrapper
"id": 123,"desc": "desc"
}]
}
}
"""
try:
id = data['id']
...
解决方法
与Azure机器学习部署一起使用的InferenceSchema,则此软件包的代码最近在MIT许可下在https://github.com/Azure/InferenceSchema上发布。因此,您可以使用它来创建特定于您的需求的版本。