Skip to main content

A client for the Microsoft Azure Custom Vision Service

Project description

https://travis-ci.org/CatalystCode/py_custom_vision_client.svg?branch=master https://img.shields.io/pypi/v/custom_vision_client.svg

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

custom_vision_client-0.0.3.tar.gz (4.2 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page