Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,10 +1,12 @@
|
|
1 |
import streamlit as st
|
2 |
-
from transformers import pipeline
|
3 |
-
|
4 |
@st.cache(allow_output_mutation=True)
|
5 |
def load_qa_model():
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
8 |
|
9 |
qa = load_qa_model()
|
10 |
st.title("Ask Questions about your Text")
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline, AutoModelForQuestionAnswering, AutoTokenizer
|
|
|
3 |
@st.cache(allow_output_mutation=True)
|
4 |
def load_qa_model():
|
5 |
+
model_name = "mrm8488/mobilebert-uncased-finetuned-squadv2"
|
6 |
+
model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
7 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
+
qa = pipeline("question-answering", model=model, tokenizer=tokenizer)
|
9 |
+
return qa
|
10 |
|
11 |
qa = load_qa_model()
|
12 |
st.title("Ask Questions about your Text")
|