<jupyter_start><jupyter_text>Web Service Endpoint を使った推論<jupyter_code>import requests
import json
import numpy as np<jupyter_output><empty_output><jupyter_text>データをロードして１レコード抽出します<jupyter_code>npz = np.load('docdata1.npz')
x = npz['arr_0']
y = npz['arr_1']
print(x.shape)
print(y.shape)
x_data = x[6500].tolist()<jupyter_output><empty_output><jupyter_text>Web Service Endpoint を指定します

- 前のステップでコピーしておいた URI を使用します<jupyter_code>scoring_uri = ''<jupyter_output><empty_output><jupyter_text>推論を実行します<jupyter_code>headers = {'Content-Type':'application/json'}
data = {"data": x_data}
response = requests.post(scoring_uri, data=json.dumps(data), headers=headers)

print(response.status_code)
print(response.elapsed)
data_retd = np.array(response.json(), dtype=np.float32)
print(data_retd)<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup