Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ st.sidebar.header('What will you like to do?')
|
|
13 |
option = st.sidebar.radio('', ['Extractive question answering', 'Text summarization', 'Text generation', 'Sentiment analysis'])
|
14 |
|
15 |
@st.cache(show_spinner=False, allow_output_mutation=True)
|
16 |
-
def
|
17 |
model_name = "deepset/roberta-base-squad2"
|
18 |
question_answerer = pipeline(model=model_name, tokenizer=model_name, revision="v1.0", task="question-answering")
|
19 |
return question_answerer
|
@@ -42,7 +42,10 @@ if option == 'Extractive question answering':
|
|
42 |
question = st.text_input(label='Enter your question')
|
43 |
button = st.button('Get answer')
|
44 |
if button:
|
|
|
45 |
with st.spinner(text="Getting answer..."):
|
|
|
|
|
46 |
answer = question_answerer(context, question)
|
47 |
st.write(answer)
|
48 |
elif source == "I want to upload a file":
|
|
|
13 |
option = st.sidebar.radio('', ['Extractive question answering', 'Text summarization', 'Text generation', 'Sentiment analysis'])
|
14 |
|
15 |
@st.cache(show_spinner=False, allow_output_mutation=True)
|
16 |
+
def question_model():
|
17 |
model_name = "deepset/roberta-base-squad2"
|
18 |
question_answerer = pipeline(model=model_name, tokenizer=model_name, revision="v1.0", task="question-answering")
|
19 |
return question_answerer
|
|
|
42 |
question = st.text_input(label='Enter your question')
|
43 |
button = st.button('Get answer')
|
44 |
if button:
|
45 |
+
question_answerer = question_model()
|
46 |
with st.spinner(text="Getting answer..."):
|
47 |
+
# answer = question_answerer(context=context, question=question)
|
48 |
+
# st.write(answer["answer"])
|
49 |
answer = question_answerer(context, question)
|
50 |
st.write(answer)
|
51 |
elif source == "I want to upload a file":
|