File size: 841 Bytes
db2e027
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c3c01b8
cc981d5
c3c01b8
 
db2e027
 
 
 
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
from transformers import AutoModelForTableQuestionAnswering, AutoTokenizer, pipeline

# Use a pipeline as a high-level helper
import streamlit as st
import pandas as pd

# Load model & tokenizer
tapas_model = AutoModelForTableQuestionAnswering.from_pretrained('navteca/tapas-large-finetuned-wtq')
tapas_tokenizer = AutoTokenizer.from_pretrained('navteca/tapas-large-finetuned-wtq')

# Get predictions
nlp = pipeline('table-question-answering', model=tapas_model, tokenizer=tapas_tokenizer)

st.title('Query your data with text')
file = st.file_uploader('Upload a csv file here')

if file is not None:
    query = st.text_input('Query')
    data = pd.read_csv(file)
    st.write(pipe(table=data))
    
    #print(data)
    '''
    st.subheader('Data')
    st.table(data.head())
    if query:
        st.write(pipe(table=data, query=query))'''