Documentation ¶
Overview ¶
Package huggingface ai界的github, 常用参数
Index ¶
Constants ¶
View Source
const ( // HuggingfaceSpaceHTTPS huggingface space https api HuggingfaceSpaceHTTPS = "https://hf.space" // Embed huggingface space api embed Embed = HuggingfaceSpaceHTTPS + "/embed" // HTTPSPushPath 推送队列 HTTPSPushPath = Embed + "/%v/api/queue/push/" // HTTPSStatusPath 状态队列 HTTPSStatusPath = Embed + "/%v/api/queue/status/" // HuggingfaceSpaceWss huggingface space wss api HuggingfaceSpaceWss = "wss://spaces.huggingface.tech" // WssJoinPath 推送队列2 WssJoinPath = HuggingfaceSpaceWss + "/%v/queue/join" // HTTPSPredictPath 推送队列3 HTTPSPredictPath = Embed + "/%v/api/predict/" // DefaultAction 默认动作 DefaultAction = "predict" // CompleteStatus 完成状态 CompleteStatus = "COMPLETE" // WssCompleteStatus 完成状态2 WssCompleteStatus = "process_completed" // TimeoutMax 超时时间 TimeoutMax = 300 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PushRequest ¶
type PushRequest struct { Action string `json:"action,omitempty"` FnIndex int `json:"fn_index"` Data []interface{} `json:"data"` SessionHash string `json:"session_hash"` }
PushRequest 推送默认请求
type PushResponse ¶
PushResponse 推送默认响应
func Push ¶
func Push(pushURL string, pushReq PushRequest) (pushRes PushResponse, err error)
Push 推送请求
type StatusResponse ¶
type StatusResponse struct { Status string `json:"status"` Data struct { Data []interface{} `json:"data"` Duration float64 `json:"duration"` AverageDuration float64 `json:"average_duration"` } }
StatusResponse 状态默认响应
Click to show internal directories.
Click to hide internal directories.