experiment_ML_model_1 / requests.py
Jurk06's picture
Create requests.py
b38be4c verified
import requests
# Define the URL of your deployed model endpoint
url = 'http://your-deployed-model-url/predict'
# Sample input data (replace this with your actual data)
data = {
'data': [[5.1, 3.5, 1.4, 0.2], [6.3, 2.9, 5.6, 1.8]]
}
# Send POST request to the deployed model endpoint
response = requests.post(url, json=data)
# Check if request was successful
if response.status_code == 200:
# Extract predictions from response
predictions = response.json()['predictions']
print("Predictions:", predictions)
else:
print("Error:", response.text)