Spaces:
Sleeping
Sleeping
updated all
Browse files
app.py
CHANGED
|
@@ -1,10 +1,9 @@
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
# Set page config FIRST — must be the first Streamlit command
|
| 4 |
st.set_page_config(page_title="BERT QA", layout="wide")
|
| 5 |
|
| 6 |
-
from transformers import pipeline
|
| 7 |
-
|
| 8 |
# Load QA pipeline with BERT model
|
| 9 |
@st.cache_resource
|
| 10 |
def load_qa_pipeline():
|
|
@@ -30,4 +29,4 @@ if st.button("Get Answer"):
|
|
| 30 |
QA_input = {"question": question, "context": context}
|
| 31 |
result = nlp(QA_input)
|
| 32 |
st.success(f"🧠 **Answer**: {result['answer']}")
|
| 33 |
-
st.caption(f"Score: {result['score']:.2f} | Start: {result['start']}, End: {result['end']}")
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
|
| 4 |
# Set page config FIRST — must be the first Streamlit command
|
| 5 |
st.set_page_config(page_title="BERT QA", layout="wide")
|
| 6 |
|
|
|
|
|
|
|
| 7 |
# Load QA pipeline with BERT model
|
| 8 |
@st.cache_resource
|
| 9 |
def load_qa_pipeline():
|
|
|
|
| 29 |
QA_input = {"question": question, "context": context}
|
| 30 |
result = nlp(QA_input)
|
| 31 |
st.success(f"🧠 **Answer**: {result['answer']}")
|
| 32 |
+
st.caption(f"Score: {result['score']:.2f} | Start: {result['start']}, End: {result['end']}")
|