Spaces:
Build error
Build error
File size: 674 Bytes
25fc3a2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
from transformers import TapasTokenizer, TapasForQuestionAnswering, pipeline
class QuestionAnswerer:
def __init__(self):
self.model_name = "google/tapas-large-finetuned-wtq"
self.tokenizer = TapasTokenizer.from_pretrained(self.model_name)
self.model = TapasForQuestionAnswering.from_pretrained(self.model_name)
self.pipe = pipeline("table-question-answering", model=self.model, tokenizer=self.tokenizer)
def query_table(self, query):
# Implement the logic to query the chroma db for the relevant table
pass
def answer_question(self, query, table):
inputs = self.pipe(table, query)
return inputs
|