A client for the Microsoft Azure Custom Vision Service
Project description
py_custom_vision_client
This repository contains a simple Python client for the Custom Vision Service.
Usage
# first, train a model
from custom_vision_client import TrainingClient, TrainingConfig
training_client = TrainingClient(TrainingConfig("my-azure-region", "my-project-name", "my-training-key"))
project_id = training_client.fetch_project_id()
training_client.create_tag("Cat")
training_client.create_tag("Dog")
training_client.add_training_image("kitten.jpg", "Cat")
training_client.add_training_image("akita.png", "Dog")
training_client.add_training_image("best-animal-pals.jpg", "Cat", "Dog")
model_id = training_client.trigger_training().Id
# then, use the model to predict:
from custom_vision_client import PredictionClient, PredictionConfig
prediction_client = PredictionClient(PredictionConfig("my-azure-region", project_id, "my-prediction-key"))
predictions = prediction_client.classify_image("cat.jpg", model_id) # could also be a url to a file
best_prediction = max(predictions, key=lambda _: _.Probability)
print(best_prediction.Tag)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for custom_vision_client-0.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5066650bee116079b14e115689227a9fcae6fc6230da12e866b2490be61cd4dd |
|
MD5 | f32651d7b6f8aa346553a3d387af7f75 |
|
BLAKE2b-256 | ecf245e81facbb93ff3079ee3e2e71ad962ff3d498f1a7c7d5fa684bb3f61b8f |