Habieb143 commited on
Commit
d7215ca
1 Parent(s): 43e821a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
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
- model = pipeline("question-answering")
7
- return model
 
 
 
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")