Last active
June 7, 2021 20:09
-
-
Save rajshah4/512913cd5a8b8184ccbbcd33c532b11f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pprint import pprint | |
def score(data, port = "6789"): | |
b_buf = BytesIO() | |
b_buf.write(data.to_csv(index=False).encode("utf-8")) | |
b_buf.seek(0) | |
url = "http://localhost:{}/predict/".format(port) | |
files = [ | |
('X', b_buf) | |
] | |
response = requests.request("POST", url, files = files, timeout=None, verify=False) | |
return response | |
scoring_data = pd.read_csv("/content/mlops-examples/MLOps_DRUM/data/boston_housing_test.csv") | |
predictions = score(scoring_data).json() ## score entire dataset but only show first 5 records | |
pprint(predictions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment