Skip to content

basetenlabs/truss-grpc-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gRPC Truss Example

This project demonstrates a gRPC service using Truss for model deployment.

Prerequisites

  • Docker CLI installed
  • Go installed
  • Access to a container registry (Docker Hub, Google Container Registry, etc.)

Setup

Get the repository with:

git clone https://github.com/basetenlabs/truss-grpc-example.git

Install Truss with:

pip install --upgrade truss

Deployment

0. Generate Protobuf files

protoc --go_out=. --go-grpc_out=. example.proto

For more information about Protobuf, refer to the Protobuf documentation.

1. Build and Push Docker Image

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

2. Update Configuration

Update the config.yaml file to use your newly built image:

base_image:
  image: your-registry/truss-grpc-demo:latest  # Replace with your image
[...]

3. Push Model with Truss

Deploy your model using the Truss CLI:

truss push . --promote

For more detailed information about Truss deployment, refer to the truss push documentation.

4. Call the Model

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published