This project demonstrates a gRPC service using Truss for model deployment.
- Docker CLI installed
- Go installed
- Access to a container registry (Docker Hub, Google Container Registry, etc.)
Get the repository with:
git clone https://github.com/basetenlabs/truss-grpc-example.git
Install Truss with:
pip install --upgrade truss
protoc --go_out=. --go-grpc_out=. example.proto
For more information about Protobuf, refer to the Protobuf documentation.
First, build the Docker image using the provided Dockerfile:
docker build -t your-registry/truss-grpc-demo:latest . --platform linux/amd64
docker push your-registry/truss-grpc-demo:latest
Update the config.yaml
file to use your newly built image:
base_image:
image: your-registry/truss-grpc-demo:latest # Replace with your image
[...]
Deploy your model using the Truss CLI:
truss push . --promote
For more detailed information about Truss deployment, refer to the truss push documentation.
Copy the model ID from the Baseten Models page into client/main.go
as the modelID
variable.
Copy the API key from the Baseten API keys page into client/main.go
as the basetenApiKey
variable.
Test the model by running the client:
go run client/main.go