Spaces:
Runtime error
Runtime error
ascari-maximilian
commited on
Commit
•
db2e027
1
Parent(s):
875cbf7
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import AutoModelForTableQuestionAnswering, AutoTokenizer, pipeline
|
2 |
+
|
3 |
+
# Use a pipeline as a high-level helper
|
4 |
+
import streamlit as st
|
5 |
+
import pandas as pd
|
6 |
+
|
7 |
+
# Load model & tokenizer
|
8 |
+
tapas_model = AutoModelForTableQuestionAnswering.from_pretrained('navteca/tapas-large-finetuned-wtq')
|
9 |
+
tapas_tokenizer = AutoTokenizer.from_pretrained('navteca/tapas-large-finetuned-wtq')
|
10 |
+
|
11 |
+
# Get predictions
|
12 |
+
nlp = pipeline('table-question-answering', model=tapas_model, tokenizer=tapas_tokenizer)
|
13 |
+
|
14 |
+
st.title('Query your data with text')
|
15 |
+
file = st.file_uploader('Upload a csv file here')
|
16 |
+
|
17 |
+
if file is not None:
|
18 |
+
query = st.text_input('Query')
|
19 |
+
data = pd.read_csv(file)
|
20 |
+
|
21 |
+
print(data)
|
22 |
+
'''
|
23 |
+
st.subheader('Data')
|
24 |
+
st.table(data.head())
|
25 |
+
if query:
|
26 |
+
st.write(pipe(table=data, query=query))'''
|