Spaces:
Sleeping
Sleeping
sdripie
commited on
Commit
·
bea7d89
1
Parent(s):
b431f4c
app description, title
Browse files
app.py
CHANGED
|
@@ -11,6 +11,15 @@ import streamlit as st
|
|
| 11 |
# Initialize the pipeline
|
| 12 |
pipe = pipeline("table-question-answering", model="google/tapas-large-finetuned-wtq")
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Define the table data
|
| 15 |
data = {
|
| 16 |
"year": [1896, 1900, 1904, 2004, 2008, 2012],
|
|
@@ -28,7 +37,7 @@ query = st.text_input("Ask a question about the table:", "In which year did beij
|
|
| 28 |
if "history" not in st.session_state:
|
| 29 |
st.session_state.history = []
|
| 30 |
|
| 31 |
-
#
|
| 32 |
if st.button("Get Answer"):
|
| 33 |
result = pipe(table=table, query=query)
|
| 34 |
st.session_state.history.append({"query": query, "answer": result["answer"]})
|
|
|
|
| 11 |
# Initialize the pipeline
|
| 12 |
pipe = pipeline("table-question-answering", model="google/tapas-large-finetuned-wtq")
|
| 13 |
|
| 14 |
+
st.set_page_config(page_title="Table Question Answering", layout="wide")
|
| 15 |
+
st.title("📊 Table Question Answering")
|
| 16 |
+
st.write("""
|
| 17 |
+
Welcome to the **Table Question Answering** app!
|
| 18 |
+
You can upload or paste your own table and ask questions about it.
|
| 19 |
+
The model will analyze the table and provide accurate answers.
|
| 20 |
+
""")
|
| 21 |
+
|
| 22 |
+
|
| 23 |
# Define the table data
|
| 24 |
data = {
|
| 25 |
"year": [1896, 1900, 1904, 2004, 2008, 2012],
|
|
|
|
| 37 |
if "history" not in st.session_state:
|
| 38 |
st.session_state.history = []
|
| 39 |
|
| 40 |
+
#process query and display result
|
| 41 |
if st.button("Get Answer"):
|
| 42 |
result = pipe(table=table, query=query)
|
| 43 |
st.session_state.history.append({"query": query, "answer": result["answer"]})
|