Spaces:
Sleeping
Sleeping
| ####################################################################################################### | |
| # IMPORT | |
| ####################################################################################################### | |
| from transformers import pipeline | |
| import pandas as pd | |
| ####################################################################################################### | |
| # 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, |