Skip to content

Commit bab0764

Browse files
author
Jim Bennett
committed
Adding more to the readme
1 parent e8a8f68 commit bab0764

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ indent-after-paren=4
217217
indent-string=' '
218218

219219
# Maximum number of characters on a single line.
220-
max-line-length=150
220+
max-line-length=140
221221

222222
# Maximum number of lines in a module
223223
max-module-lines=1000

README.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,15 @@ Introduction
1717
:target: https://github.com/psf/black
1818
:alt: Code Style: Black
1919

20-
CircuitPython library for the Azure custom vision SDK
20+
CircuitPython prediction library for the Azure custom vision service.
2121

22+
To use this library, you will need to create a custom vision project at [CustomVision.ai](https://customvision.ai?WT.mc_id=circuitpythoncustomvisionprediction-github-jabenn).
23+
Once you have your project, you will need to train either an image classification model, or an object detection model. You can then use this library to make predictions against this model.
24+
25+
You can read more on how to do this in the Microsoft docs:
26+
27+
* [Train an image classifier](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/getting-started-build-a-classifier?WT.mc_id=circuitpythoncustomvisionprediction-github-jabenn)
28+
* [Train an object detection model](https://docs.microsoft.com/azure/cognitive-services/custom-vision-service/get-started-build-detector?WT.mc_id=circuitpythoncustomvisionprediction-github-jabenn)
2229

2330
Dependencies
2431
=============

customvision.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def __init__(self, response) -> None:
109109
self.predictions.append(prediction)
110110

111111

112-
def __run_request(url, body, headers):
112+
def __run_request_with_retry(url, body, headers):
113113
retry = 0
114114
r = None
115115
logger = logging.getLogger("log")
@@ -180,7 +180,7 @@ def __process_image_url(self, route: str, project_id: str, published_name: str,
180180
headers = {"Content-Type": "application/json", "Prediction-Key": self.__api_key}
181181

182182
body = json.dumps({"url": url})
183-
result = __run_request(endpoint, body, headers)
183+
result = __run_request_with_retry(endpoint, body, headers)
184184
result_text = result.text
185185

186186
return ImagePrediction(result_text)
@@ -190,7 +190,7 @@ def __process_image(self, route: str, project_id: str, published_name: str, imag
190190

191191
headers = {"Content-Type": "application/octet-stream", "Prediction-Key": self.__api_key}
192192

193-
result = __run_request(endpoint, image_data, headers)
193+
result = __run_request_with_retry(endpoint, image_data, headers)
194194
result_text = result.text
195195

196196
return ImagePrediction(result_text)

0 commit comments

Comments
 (0)