bartserver

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: BSD-2-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dump

func Dump(value interface{}, pretty bool) ([]byte, error)

Dump serializes the given value to JSON.

Types

type ClassConfidencePair

type ClassConfidencePair struct {
	Class      string    `json:"class"`
	Confidence mat.Float `json:"confidence"`
}

ClassConfidencePair is a JSON-serializable pair of Class and Confidence.

type ClassifyResponse

type ClassifyResponse struct {
	Class        string                `json:"class"`
	Confidence   mat.Float             `json:"confidence"`
	Distribution []ClassConfidencePair `json:"distribution"`
	// Took is the number of milliseconds it took the server to execute the request.
	Took int64 `json:"took"`
}

ClassifyResponse is a JSON-serializable structure which holds server classification response data.

type ServerForSequenceClassification

type ServerForSequenceClassification struct {
	TimeoutSeconds  int
	MaxRequestBytes int

	// UnimplementedBARTServer must be embedded to have forward compatible implementations for gRPC.
	grpcapi.UnimplementedBARTServer
	// contains filtered or unexported fields
}

ServerForSequenceClassification contains everything needed to run a BART server.

func NewServer

NewServer returns a new ServerForSequenceClassification.

func (*ServerForSequenceClassification) Classify

Classify handles a classification request over gRPC.

func (*ServerForSequenceClassification) ClassifyHandler

func (s *ServerForSequenceClassification) ClassifyHandler(w http.ResponseWriter, req *http.Request)

ClassifyHandler handles a classify request over HTTP.

func (*ServerForSequenceClassification) ClassifyNLI

ClassifyNLI handles a zero-shot classification request over gRPC.

func (*ServerForSequenceClassification) ClassifyNLIHandler

func (s *ServerForSequenceClassification) ClassifyNLIHandler(w http.ResponseWriter, req *http.Request)

ClassifyNLIHandler handles a classify request over HTTP.

func (*ServerForSequenceClassification) StartDefaultHTTPServer

func (s *ServerForSequenceClassification) StartDefaultHTTPServer(address, tlsCert, tlsKey string, tlsDisable bool)

StartDefaultHTTPServer is used to start a basic BERT HTTP server. If you want more control of the HTTP server you can run your own HTTP router using the public handler functions

func (*ServerForSequenceClassification) StartDefaultServer

func (s *ServerForSequenceClassification) StartDefaultServer(grpcAddress, tlsCert, tlsKey string, tlsDisable bool)

StartDefaultServer is used to start a basic BART gRPC server.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL