Versions in this module Expand all Collapse all v3 v3.1.0 Oct 1, 2024 v3.0.0 Jul 11, 2024 Changes in this version + const APIBaseURL + const AuthHeaderKey + const AuthHeaderPrefix + const MaxCandidateLabels + const RecommendedAudioClassificationModel + const RecommendedConversationalModel + const RecommendedFillMaskModel + const RecommendedImageClassificationModel + const RecommendedImageSegmentationModel + const RecommendedImageToTextModel + const RecommendedObjectDetectionModel + const RecommendedQuestionAnsweringModel + const RecommendedRussianToEnglishModel + const RecommendedSentenceSimilarityModel + const RecommendedSpeechRecongnitionModelEnglish + const RecommendedTableQuestionAnsweringModel + const RecommendedTextClassificationModel + const RecommendedTextGenerationModel + const RecommendedTextToImageModel + const RecommendedTokenClassificationModel + const RecommendedZeroShotModel + const RecommmendedSummarizationModel + const TextGenerationGrammarTypeJSON + const TextGenerationGrammarTypeRegex + var APIKey = func() string + func MakeHFAPIRequest(jsonBody []byte, model string) ([]byte, error) + func MakeHFAPIRequestWithMedia(model, mediaFile string) ([]byte, error) + func SendTextToImageRequest(model string, request *TextToImageRequest) (image.Image, string, error) + func SetAPIKey(key string) + type AggregationStrategy string + const AggregationStrategyAverage + const AggregationStrategyFirst + const AggregationStrategyMax + const AggregationStrategyNone + const AggregationStrategySimple + type AudioClassificationResponse struct + Label string + Score float64 + func SendAudioClassificationRequest(model, audioFile string) ([]*AudioClassificationResponse, error) + type Conversation struct + GeneratedResponses []string + PastUserInputs []string + type ConversationalParameters struct + MaxLength *int + MaxTime *float64 + MinLength *int + RepetitionPenalty *float64 + Temperature *float64 + TopK *int + TopP *float64 + func NewConversationalParameters() *ConversationalParameters + func (c *ConversationalParameters) SetMaxLength(maxLength int) *ConversationalParameters + func (c *ConversationalParameters) SetMaxTime(maxTime float64) *ConversationalParameters + func (c *ConversationalParameters) SetMinLength(minLength int) *ConversationalParameters + func (c *ConversationalParameters) SetRepetitionPenalty(penalty float64) *ConversationalParameters + func (c *ConversationalParameters) SetTempurature(temperature float64) *ConversationalParameters + func (c *ConversationalParameters) SetTopK(topK int) *ConversationalParameters + func (c *ConversationalParameters) SetTopP(topP float64) *ConversationalParameters + type ConversationalRequest struct + Inputs ConverstationalInputs + Options Options + Parameters ConversationalParameters + type ConversationalResponse struct + Conversation Conversation + GeneratedText string + func SendConversationalRequest(model string, request *ConversationalRequest) (*ConversationalResponse, error) + type ConverstationalInputs struct + GeneratedResponses []string + PastUserInputs []string + Text string + type FillMaskRequest struct + Inputs []string + Options Options + type FillMaskResponse struct + Masks []*FillMaskResponseEntry + func SendFillMaskRequest(model string, request *FillMaskRequest) ([]*FillMaskResponse, error) + type FillMaskResponseEntry struct + Score float64 + Sequence string + TokenID int + TokenStr string + type ImageClassificationResponse struct + Label string + Score float64 + func SendImageClassificationRequest(model, imageFile string) ([]*ImageClassificationResponse, error) + type ImageSegmentationResponse struct + Label string + Mask string + Score float64 + func SendImageSegmentationRequest(model, imageFile string) ([]*ImageSegmentationResponse, error) + type ImageToTextResponse struct + GeneratedText string + func SendImageToTextRequest(model, imageFile string) ([]*ImageToTextResponse, error) + type ObjectBox struct + XMax int + XMin int + YMax int + YMin int + type ObjectDetectionResponse struct + Box ObjectBox + Label string + Score float64 + func SendObjectDetectionRequest(model, imageFile string) ([]*ObjectDetectionResponse, error) + type Options struct + UseCache *bool + UseGPU *bool + WaitForModel *bool + func NewOptions() *Options + func (opts *Options) SetUseCache(useCache bool) *Options + func (opts *Options) SetUseGPU(useGPU bool) *Options + func (opts *Options) SetWaitForModel(waitForModel bool) *Options + type QuestionAnsweringInputs struct + Context string + Question string + type QuestionAnsweringRequest struct + Inputs QuestionAnsweringInputs + Options Options + type QuestionAnsweringResponse struct + Answer string + End int + Score float64 + Start int + func SendQuestionAnsweringRequest(model string, request *QuestionAnsweringRequest) (*QuestionAnsweringResponse, error) + type SentenceSimilarityInputs struct + Sentences []string + SourceSentence string + type SentenceSimilarityRequest struct + Inputs SentenceSimilarityInputs + Options Options + type SentenceSimilarityResponse []float64 + func SendSentenceSimilarityRequest(model string, request *SentenceSimilarityRequest) (*SentenceSimilarityResponse, error) + type SpeechRecognitionResponse struct + Text string + func SendSpeechRecognitionRequest(model, audioFile string) (*SpeechRecognitionResponse, error) + type SummarizationParameters struct + MaxLength *int + MaxTime *float64 + MinLength *int + RepetitionPenalty *float64 + Temperature *float64 + TopK *int + TopP *float64 + func NewSummarizationParameters() *SummarizationParameters + func (sp *SummarizationParameters) SetMaxLength(maxLength int) *SummarizationParameters + func (sp *SummarizationParameters) SetMaxTime(maxTime float64) *SummarizationParameters + func (sp *SummarizationParameters) SetMinLength(minLength int) *SummarizationParameters + func (sp *SummarizationParameters) SetRepetitionPenalty(penalty float64) *SummarizationParameters + func (sp *SummarizationParameters) SetTempurature(temperature float64) *SummarizationParameters + func (sp *SummarizationParameters) SetTopK(topK int) *SummarizationParameters + func (sp *SummarizationParameters) SetTopP(topP float64) *SummarizationParameters + type SummarizationRequest struct + Inputs []string + Options Options + Parameters SummarizationParameters + type SummarizationResponse struct + SummaryText string + func SendSummarizationRequest(model string, request *SummarizationRequest) ([]*SummarizationResponse, error) + type TableQuestionAnsweringInputs struct + Query string + Table map[string][]string + type TableQuestionAnsweringRequest struct + Inputs TableQuestionAnsweringInputs + Options Options + type TableQuestionAnsweringResponse struct + Aggregator string + Answer string + Cells []string + Coordinates [][]int + func SendTableQuestionAnsweringRequest(model string, request *TableQuestionAnsweringRequest) (*TableQuestionAnsweringResponse, error) + type TextClassificationRequest struct + Inputs []string + Options Options + type TextClassificationResponse struct + Labels []*TextClassificationResponseLabel + func SendTextClassificationRequest(model string, request *TextClassificationRequest) ([]*TextClassificationResponse, error) + type TextClassificationResponseLabel struct + Name string + Score float64 + type TextGenerationBestOfSequence struct + FinishReason string + GeneratedText string + GeneratedTokens int + Prefill []*TextGenerationPrefillToken + Seed int64 + Tokens []*TextGenerationToken + TopTokens [][]*TextGenerationToken + type TextGenerationParameters struct + BestOf *int + DecoderInputDetails *bool + Details *bool + DoSample *bool + FrequencyPenalty *float64 + Grammar *string + MaxNewTokens *int + RepetitionPenalty *float64 + ReturnFullText *bool + Seed *int64 + Stop []string + Temperature *float64 + TopK *int + TopNTokens *int + TopP *float64 + Truncate *int + TypicalP *float64 + Watermark *bool + func NewTextGenerationParameters() *TextGenerationParameters + func (params *TextGenerationParameters) SetBestOf(bestOf int) *TextGenerationParameters + func (params *TextGenerationParameters) SetDecoderInputDetails(decoderInputDetails bool) *TextGenerationParameters + func (params *TextGenerationParameters) SetDetails(details bool) *TextGenerationParameters + func (params *TextGenerationParameters) SetDoSample(doSample bool) *TextGenerationParameters + func (params *TextGenerationParameters) SetFrequencyPenalty(frequencyPenalty float64) *TextGenerationParameters + func (params *TextGenerationParameters) SetGrammar(grammar string) *TextGenerationParameters + func (params *TextGenerationParameters) SetMaxNewTokens(maxNewTokens int) *TextGenerationParameters + func (params *TextGenerationParameters) SetRepetitionPenalty(repetitionPenalty float64) *TextGenerationParameters + func (params *TextGenerationParameters) SetRepetitionPenaly(penalty float64) *TextGenerationParameters + func (params *TextGenerationParameters) SetReturnFullText(returnFullText bool) *TextGenerationParameters + func (params *TextGenerationParameters) SetSeed(seed int64) *TextGenerationParameters + func (params *TextGenerationParameters) SetStop(stop []string) *TextGenerationParameters + func (params *TextGenerationParameters) SetTemperature(temperature float64) *TextGenerationParameters + func (params *TextGenerationParameters) SetTopK(topK int) *TextGenerationParameters + func (params *TextGenerationParameters) SetTopNTokens(topNTokens int) *TextGenerationParameters + func (params *TextGenerationParameters) SetTopP(topP float64) *TextGenerationParameters + func (params *TextGenerationParameters) SetTruncate(truncate int) *TextGenerationParameters + func (params *TextGenerationParameters) SetTypicalP(typicalP float64) *TextGenerationParameters + func (params *TextGenerationParameters) SetWatermark(watermark bool) *TextGenerationParameters + type TextGenerationPrefillToken struct + ID int + LogProb float64 + Text string + type TextGenerationRequest struct + Input string + Options Options + Parameters TextGenerationParameters + type TextGenerationResponse struct + Details TextGenerationResponseDetails + GeneratedText string + func SendTextGenerationRequest(model string, request *TextGenerationRequest) ([]*TextGenerationResponse, error) + type TextGenerationResponseDetails struct + BestOfSequences []*TextGenerationBestOfSequence + FinishReason string + GeneratedTokens int + Prefill []*TextGenerationPrefillToken + Seed int64 + Tokens []*TextGenerationToken + TopTokens []*TextGenerationToken + type TextGenerationToken struct + Special bool + type TextToImageRequest struct + Inputs string + Options Options + Parameters TextToImageRequestParameters + type TextToImageRequestParameters struct + GuidanceScale float64 + Height int64 + NegativePrompt string + NumInferenceSteps int64 + Width int64 + type TokenClassificationParameters struct + AggregationStrategy *AggregationStrategy + func NewTokenClassificationParameters() *TokenClassificationParameters + func (params *TokenClassificationParameters) SetAggregationStrategy(aggregationStrategy AggregationStrategy) *TokenClassificationParameters + type TokenClassificationRequest struct + Inputs []string + Options Options + Parameters TokenClassificationParameters + type TokenClassificationResponse struct + Entities []*TokenClassificationResponseEntity + func SendTokenClassificationRequest(model string, request *TokenClassificationRequest) ([]*TokenClassificationResponse, error) + type TokenClassificationResponseEntity struct + End int + Entity string + Label string + Score float64 + Start int + type TranslationRequest struct + Inputs []string + Options Options + type TranslationResponse struct + TranslationText string + func SendTranslationRequest(model string, request *TranslationRequest) ([]*TranslationResponse, error) + type ZeroShotParameters struct + CandidateLabels []string + MultiLabel *bool + func (zsp *ZeroShotParameters) SetMultiLabel(multiLabel bool) *ZeroShotParameters + type ZeroShotRequest struct + Inputs []string + Options Options + Parameters ZeroShotParameters + type ZeroShotResponse struct + Labels []string + Scores []float64 + Sequence string + func SendZeroShotRequest(model string, request *ZeroShotRequest) ([]*ZeroShotResponse, error) Other modules containing this package github.com/Kardbord/hfapigo/v2