Python API¶
Installation¶
NGC currently hosts the Jarvis API Python wheel. You will need to provide an NGC API key to retrieve it. The key can be provided either through the variable
NGC_API_KEY
or as a configuration file (which is automatically generated by runningngc config set
).Retrieve the Jarvis resources from NGC and enter the directory.
ngc registry resource download-version "nvidia/jarvis/jarvis_quickstart:1.0.0-b.1" cd jarvis_quickstart_v1.0.0-b.1
Install the
jarvis-speech
Python wheel locally.pip install jarvis_api-1.0.0-b.1-py3-none-any.whl
Python Example¶
The following steps show how you can integrate Jarvis AI Services into your own application using Python as an example. Full API documentation for all services and message types can be found in gRPC & Protocol Buffers.
With the Python bindings successfully installed, integrate the Jarvis services in your application. For example, to classify the intent of a query, you would add:
1 2 3 4 5 6 7 8 9 10 11 12 13
# required imports import grpc import jarvis_api.jarvis_nlp_pb2 as jnlp # establish connection to Jarvis server and initialize client channel = grpc.insecure_channel('localhost:50051') server = jnlp.JarvisNLPStub(channel) # make request req = jnlp.AnalyzeIntentRequest(query="How is the weather today in New England") resp = server.AnalyzeIntent(req) print(resp.intent.class_name)