test / app.py
ascari-maximilian's picture
Update app.py
cc981d5
raw
history blame
841 Bytes
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))'''