chatbot2 / app.py
princegupta19998's picture
Create app.py
b7ede78
# import library
import warnings
warnings.filterwarnings("ignore")
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"])