<jupyter_start><jupyter_text>Api invocation<jupyter_code>import requests
import pandas as pd
data_path = './wine-quality-white.csv'
test_data = pd.read_csv(data_path)
test_data = test_data.drop(columns= 'quality').head(10)
%%time 
host = 'mlflow_serving_loadbalancerip'
port = '8082'
url = f'http://{host}:{port}/invocations'

# Send a batch of data to the endpoint with a post request
headers = {
    'Content-Type': 'application/json',
}
http_data = test_data.to_json(orient='split')
r = requests.post(url=url, headers=headers, data=http_data)

result = eval(r.text)
result<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13884297520661157, 'fraction_numerical': 0.009917355371900827, 'mean_word_length': 6.481481481481482, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '25188', 'license': 'MIT', 'n_tokens_mistral': 226, 'n_tokens_neox': 217, 'n_words': 45, 'path': 'notebooks/2. query mlflow serve API.ipynb', 'repo_name': 'artefactory-global/mlflow-serving-example', 'size': '605'}