github.com/hupe1980/go-huggingface@v0.0.15/_examples/table_question_answering/main.go (about) 1 package main 2 3 import ( 4 "context" 5 "fmt" 6 "log" 7 "os" 8 9 "github.com/hupe1980/go-huggingface" 10 ) 11 12 func main() { 13 ic := huggingface.NewInferenceClient(os.Getenv("HUGGINGFACEHUB_API_TOKEN")) 14 15 res, err := ic.TableQuestionAnswering(context.Background(), &huggingface.TableQuestionAnsweringRequest{ 16 Inputs: huggingface.TableQuestionAnsweringInputs{ 17 Query: "How many stars does the transformers repository have?", 18 Table: map[string][]string{ 19 "Repository": {"Transformers", "Datasets", "Tokenizers"}, 20 "Stars": {"36542", "4512", "3934"}, 21 "Contributors": {"651", "77", "34"}, 22 }, 23 }, 24 }) 25 if err != nil { 26 log.Fatal(err) 27 } 28 29 fmt.Println("Answer:", res.Answer) 30 fmt.Println("Coordinates:", res.Coordinates) 31 fmt.Println("Cells:", res.Cells) 32 fmt.Println("Aggregator:", res.Aggregator) 33 }