You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Changing detector_id to detector. Userguide updates (#12)
BREAKING CHANGE. `detector_id` is no long accepted as a named arg. Must use `detector` instead, which can now be an id string or a detector object.
* Adding section on edge to User Guide.
* Adding a partial `get_or_create_detector` method to SDK.
* Doesn't fail silently if pagination would be needed.
* submit_image_query can accept a detector or a detector_id
* Consolidating the code samples into a single snippet.
* format udpates
* Wordsmithing the user guide.
* Improving interface and docs based on feedback.
* Moving exception handling to bottom of userguide.
* Ooops taking out jpeg_from_numpy which isn't supposed to be on this branch. Bad merge.
* Changing tests to pass `detector` instead of `detector_id`
Copy file name to clipboardExpand all lines: README.md
+4-28Lines changed: 4 additions & 28 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,37 +12,13 @@ $ pip install groundlight
12
12
$ poetry add groundlight
13
13
```
14
14
15
-
### Basic Usage
15
+
### Usage
16
16
17
-
To access the API, you need an API token. You can create one on the [groundlight website](https://app.groundlight.ai/reef/my-account/api-tokens). Then, you're ready to use the SDK!
18
-
19
-
```Python
20
-
from groundlight import Groundlight
21
-
22
-
# Load the API client. This defaults to the prod endpoint,
23
-
# but you can specify a different endpoint like so:
detector = gl.create_detector(name="Dog", query="Is it a dog?")
29
-
30
-
# (Or, create a detector with a specific named ML config from https://github.com/positronix-ai/zuuul/blob/main/pysrc/predictor_config/binary_classification_predictors.yaml)
31
-
# detector = gl.create_detector(name="Dog", query="Is it a dog?", config_name="b4mu11-mlp")
32
-
33
-
# Call an API method (e.g., retrieve a list of detectors)
34
-
detectors = gl.list_detectors()
35
-
```
36
-
37
-
(Alternatively, you can use the token by setting the `GROUNDLIGHT_API_TOKEN` environment variable.)
38
-
39
-
### What API methods are available?
40
-
41
-
Check out the [User Guide](UserGuide.md)!
17
+
For instructions on using the SDK see the public [User Guide](UserGuide.md).
42
18
43
19
For more details, see the [Groundlight](src/groundlight/client.py)
44
-
class. This SDK closely follows the methods in our [API
`groundlight` is a python SDK for working with the Groundlight API. You can send image queries and receive predictions powered by a mixture of machine learning models and human labelers in-the-loop.
3
+
Groundlight makes it simple to understand images. You can easily create computer vision detectors just by describing what you want to know using natural language.
4
4
5
-
*Note: The SDK is currently in "alpha" phase.*
5
+
How does it work? Your images are first analyzed by machine learning (ML) models which are automatically trained on your data. If those models have high enough confidence, that's your answer. But if the models are unsure, then the images are progressively escalated to more resource-intensive analysis methods up to real-time human review. So what you get is a computer vision system that starts working right away without even needing to first gather and label a dataset. At first it will operate with high latency, because people need to review the image queries. But over time, the ML systems will learn and improve so queries come back faster with higher confidence.
6
6
7
-
## Pre-reqs
7
+
*Note: The SDK is currently in "beta" phase. Interfaces are subject to change in future versions.*
8
+
9
+
10
+
## Simple Example
11
+
12
+
How to build a computer vision system in 5 lines of python code:
13
+
14
+
```Python
15
+
from groundlight import Groundlight
16
+
gl = Groundlight()
17
+
18
+
# Create a new detector: use natural language to describe what you want to understand
19
+
detector = gl.create_detector(name="door", query="Is the door open?")
[groundlight web app](https://app.groundlight.ai/reef/my-account/api-tokens).
17
39
18
-
1. Use the `Groundlight` client!
40
+
The API token should be stored securely. You can use it directly in your code to initialize the SDK like:
19
41
20
-
```Python
21
-
from groundlight import Groundlight
22
-
gl = Groundlight(api_token="<YOUR_API_TOKEN>")
23
-
```
42
+
```python
43
+
gl = Groundlight(api_token="<YOUR_API_TOKEN>")
44
+
```
24
45
25
-
The API token should be stored securely - do not commit it to version control! Alternatively, you can use the token by setting the `GROUNDLIGHT_API_TOKEN` environment variable.
46
+
which is an easy way to get started, but is NOT a best practice. Please do not commit your API Token to version control! Instead we recommend setting the `GROUNDLIGHT_API_TOKEN` environment variable outside your code so that the SDK can find it automatically.
47
+
48
+
```bash
49
+
$ export GROUNDLIGHT_API_TOKEN=api_2asdfkjEXAMPLE
50
+
$ python glapp.py
51
+
```
26
52
27
-
## Basics
28
53
29
-
#### Create a new detector
54
+
## Using Groundlight on the edge
55
+
56
+
Starting your model evaluations at the edge reduces latency, cost, network bandwidth, and energy. Once you have downloaded and installed your Groundlight edge models, you can configure the Groundlight SDK to use your edge environment by configuring the 'endpoint' to point at your local environment as such:
30
57
31
58
```Python
32
-
detector = gl.create_detector(name="Dog", query="Is it a dog?")
In practice, you may want to check for a new result on your query. For example, after a cloud reviewer labels your query. For example, you can use the `image_query.id` after the above `submit_image_query()` call.
0 commit comments