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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e367aa9fe9156262e591707b41fb5f4042bd1895b91b1b1ecce8f51de6b32a9a |
|
MD5 | 6f01fff05506716e2537dccfa9ebe3cb |
|
BLAKE2b-256 | 4ef08030a4edb32a02fc1b962ec8735711731c2f62d45ae704d9241160a9bcd6 |