princegupta19998 commited on
Commit
69c047b
1 Parent(s): 98f12a4

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import pandas as pd # pandas for datafrang
3
+
4
+ # we import pipeline using transfromer library
5
+ from transformers import pipeline
6
+
7
+
8
+ # we creates a pipeline specifically designed for answering questions based on a table using a pre-trained model.
9
+ pipe = pipeline(task="table-question-answering",model="google/tapas-base-finetuned-wtq")
10
+
11
+ #uploading csv
12
+ table=pd.read_csv(input("input the CSV file link: "))
13
+
14
+ # converts the data types of all elements in a pandas DataFrame (table) to strings
15
+ table = table.astype(str)
16
+ table
17
+
18
+ #The code you provided combines user input and table-based question answering
19
+ query=input("type the Question: ")
20
+ print(pipe(table=table,query=query)["answer"])