File size: 691 Bytes
69c047b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import torch
import pandas as pd # pandas for datafrang

# we import pipeline using transfromer library
from transformers import pipeline


# we creates a pipeline specifically designed for answering questions based on a table using a pre-trained model. 
pipe = pipeline(task="table-question-answering",model="google/tapas-base-finetuned-wtq")

#uploading csv 
table=pd.read_csv(input("input the CSV file link: "))

# converts the data types of all elements in a pandas DataFrame (table) to strings
table = table.astype(str)
table

#The code you provided combines user input and table-based question answering
query=input("type the Question: ")
print(pipe(table=table,query=query)["answer"])