Serving
Client
To interact with the Infery server, you can create a client using Infery or using Triton client. The client supports both HTTP and gRPC protocols and allows you to connect to the server using different options as described below:
Installation
Before creating the client, make sure you have the required dependencies installed. You can install them using infery install
infery install --client grpc
infery install --client http
Usage
The Client class allows you to create a client for the Infery server. You can initialize the client using the one of the following formats:
- 'protocol://host:port'
- 'host:port'
- Or, by defining the following arguments:
- protocol (str, "grpc" or "http")
- host (str)
- port (int)
Example
Here's an example of how to use the Client class:
from infery.remote.client.client import Client
# Example 1: Creating a default client with HTTP protocol, host 127.0.0.1, and port 8000.
client1 = Client()
# Example 2: Creating a client with HTTP protocol, host 127.0.0.1, and port 8484.
client2 = Client(address='http://127.0.0.1:8484/')
# Example 3: Creating a client with gRPC protocol, host 127.0.0.1, and port 9001.
client3 = Client(address='grpc://127.0.0.1:9001/')
# Example 4: Creating a client with HTTP protocol, host 127.0.0.1, and port 8484.
client4 = Client(address='127.0.0.1:8484')
# Example 5: Creating a client with gRPC protocol, host 127.0.0,1, and port 9000.
client5 = Client(protocol="grpc", host="127.0.0.1", port=9000)