VIAI-SDK
A project to make working with the VIAI (https://cloud.google.com/solutions/visual-inspection-ai) REST API easier.
Design
The current pre-alpha design:
Usage
Basic tasks for the VIAI SDK.
GCP Credentials
You can supply a keyfile parameter to supply a Service Account keyfile or specify the standard GOOGLE_APPLICATION_CREDENTIALS environment variable.
If you supply the keyfile parameter, it automatically sets the GOOGLE_APPLICATION_CREDENTIALS to the same value.
Project ID
The GCP Project ID is read from the service account keyfile.
Service Account Requirements
The following roles should be bound for the service account:
Starting out
>>> from viai import VIAI
>>> a = VIAI(keyfile='viai-key.json')
>>> dir(a)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__',
'__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
'_getAuthCredentials', '_getSolutions', '_loadAllSolutions', 'apiUrl', 'author', 'credentials', 'projectId', 'region',
'requestHeader', 'solutions']
Loading a Solution/Dataset
>>> from viai import VIAI
>>> a = VIAI()
>>> b = a.solutions[0]
>>> b.load()
<viai.Solution object at 0x7ff0a9497310>
>>> b.load()
>>> dir(b)
['VIAI', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init_
_', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__
str__', '__subclasshook__', '__weakref__', '_getAnnotationSets', '_getAnnotationSpecs', '_getImages', '_getModules', '_getSolutionArtifacts', 'annotationSe
ts', 'annotationSpecs', 'apiUrl', 'createTime', 'datasetId', 'datasetUrl', 'displayName', 'images', 'load', 'log', 'modules', 'name', 'requestHeader', 'sol
utionArtifacts', 'solutionType', 'updateTime', 'url']
Working with images in a solution
>>> from viai import VIAI
>>> a = VIAI(keyfile='viai-key.json')
>>> b = a.solutions[3]
>>> b.load()
2022-07-25 18:05:59,922 [INFO] Loading Solution Data- style1horizontals
>>> c = b.images[0]
>>> d = c.getGcsBlob()
>>> type(d)
<class 'google.cloud.storage.blob.Blob'>
>>> d.public_url
'https://storage.googleapis.com/myproejct/myimage.jpg'
Development
Testing and Code Coverage
cd viai-sdk
PYTHONPATH=$PYTHONPATH:$PWD/src;coverage run -m nose2 -v
coverage report -m
Contributing
Merge requests are always welcome, and reach out to me at jamieduncan@google.com with ideas and questions! Official policies are outlines in CONTRIBUTING.md
Metadata
Release files for viai-sdk 0.1.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| viai-sdk-0.1.16.tar.gz | 16.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| viai_sdk-0.1.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 33.6 kB
Release files / viai-sdk-0.1.16.tar.gz
| Download URL | viai-sdk-0.1.16.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53382e2b539102d9911feb178fed222278151f515cea3c206f5e171ba6efa995
|
|
BLAKE2b-256 checksum How to use checksums |
21af76c636833d0af0b8ca0c48c71ed531db6a4e0ce30c6b34792bb78ac88db7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / viai_sdk-0.1.16-py3-none-any.whl
| Download URL | viai_sdk-0.1.16-py3-none-any.whl |
|---|---|
| Size | 17.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4016c06fc3eea1bf71554ef496ab59f8f12d0056bc36c95c7244f49584534fb6
|
|
BLAKE2b-256 checksum How to use checksums |
95b26c6d04454623ec61311c7a97cfb1b2a01f3791d9d588734143f81b2deb8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for viai-sdk 0.1.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.