33-AzureML-2/solution-v2/azml_04_test_inference.py

24 lines
575 B
Python
Raw Permalink Normal View History

2024-09-04 10:15:43 +02:00
"""
Script to use real-time inferencing with online endpoints
"""
from azml_03_realtime_inference import online_endpoint_name
from ml_client import create_or_load_ml_client
def main():
# 1. Load a Workspace
ml_client = create_or_load_ml_client()
# 2. Get predictions
output = ml_client.online_endpoints.invoke(
endpoint_name=online_endpoint_name,
deployment_name=online_endpoint_name,
request_file="./diabetes_test_inference/request.json",
)
print(output)
if __name__ == "__main__":
main()