Spaces:
Runtime error
Runtime error
File size: 775 Bytes
a5b2c8a 5b06122 ed5d9aa efd78a6 5b06122 0d147fa ed5d9aa 5b06122 |
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 |
# import streamlit as st
# from transformers import pipeline
# pipe=pipeline('sentiment-analysis')
# text=st.text_area('enter some text!')
# if text:
# out = pipe(text)
# st.json(out)
import streamlit as st
from transformers import pipeline
import pandas as pd
# prepare table + question
data = {"Neighborhood": ["Upper East Side", "Soho", "Upper West Side"], "Number of Apartments": ["87", "53", "69"]}
table = pd.DataFrame.from_dict(data)
question = "how many apartments does Upper East Side have?"
# pipeline model
# Note: you must to install torch-scatter first.
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
# result
st.json(tqa(table=table, query=question))
# print(tqa(table=table, query=query)['cells'][0])
#53 |