When using Inference Schema to autogenerate the swagger doc for my AzureML endpoint (as detailed here and here), I see that it creates a wrapper around my input_sample. Is there a way to not wrap the input inside this “data” wrapper?
Here is what my score.py looks like:
JavaScript
x
30
30
1
input_sample = {
2
"id": 123,
3
"language": "en"
4
"items": [{
5
"item": 1,
6
"desc": "desc"
7
}]
8
}
9
output_sample = [{'prediction': 'true', 'predictionConfidence': 0.8279970776764844}]
10
11
@input_schema('data', StandardPythonParameterType(input_sample))
12
@output_schema(StandardPythonParameterType(output_sample))
13
def run(data):
14
"""
15
{
16
data: { --> DON'T WANT this "data" wrapper
17
"id": 123,
18
"language": "en"
19
"items": [{
20
"item": 1,
21
"desc": "desc"
22
}]
23
}
24
}
25
"""
26
try:
27
id = data['id']
28
29
30
Advertisement
Answer
InferenceSchema used with Azure Machine Learning deployments, then the code for this package was recently published at https://github.com/Azure/InferenceSchema under an MIT license. So you could possibly use that to create a version specific to your needs.