GID_HuggingFace / modules /language_model.py
kleinhoellental's picture
Update modules/language_model.py
08d6a46
raw
history blame contribute delete
No virus
979 Bytes
#######################################################################################################
# IMPORT
#######################################################################################################
from transformers import pipeline
#######################################################################################################
# Function
#######################################################################################################
def TAPAS(question, table_main):
"""
Processing the question using an expression and the main and geom table.
Args:
question (str): the question.
table_main (df): main table
Returns:
answer (str): answer to the question
"""
# set up a TAPAS pipeline for table-based question answering
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
answer = tqa(table=table_main, query=question)
return answer,