It seems your input is CUSTOMERCODE and target is DESCRIPTION, however, you are entering data for the target column when it is expecting only CUSTOMERCODE as input. Hope this helps!
Error while consuming the deployed web service through python
I have tried consuming the web service with python with the link how-to-consume-web-service. I'm getting an error
predict() missing 1 required positional argument: 'X'
I have trained the model to predict only one field " DESCRIPTION" and two input fields "CUSTOMERCODE", "DESCRIPTION"
when I try to predict with input data with the code below:
import requests
import jsonURL for the web service
scoring_uri = 'xxx'
If the service is authenticated, set the key or token
key = 'xxx'
Two sets of data to score, so we get two results back
data = {"data":
[
[
"10000",
"CAPPUCINO"
],
[
"12345",
"CAFFINE"
]
]
}
input_data = json.dumps(data)
headers = {'Content-Type': 'application/json'}
headers['Authorization'] = f'Bearer {key}'
resp = requests.post(scoring_uri, input_data, headers=headers)
print(resp.text)
2 answers
Sort by: Most helpful
-
-
GiftA-MSFT 11,171 Reputation points
2021-03-02T02:43:22.363+00:00 Hi, can you try testing your model locally first to view the results and the expected format for your test data? It seems you performed some transformations when fitting the model, so you need to ensure that you are providing your test data with the expected shape and dimension of the array. Hope this helps!