File size: 979 Bytes
01af525
 
 
 
 
 
08d6a46
01af525
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#######################################################################################################
# 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,