Update app.py
Browse files
app.py
CHANGED
@@ -1,25 +1,33 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
3 |
|
4 |
-
|
|
|
|
|
5 |
|
6 |
-
|
7 |
-
https://colab.research.google.com/drive/17s4mJEUqE6OCVbdAOw1ROMQOpf4NBAw1
|
8 |
-
"""
|
9 |
|
10 |
-
|
11 |
-
|
|
|
|
|
|
|
|
|
|
|
12 |
|
13 |
-
classifier = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
14 |
def main():
|
15 |
st.title("Question & Answering")
|
16 |
|
17 |
with st.form("text_field"):
|
18 |
-
|
19 |
-
|
|
|
|
|
20 |
clicked = st.form_submit_button("Submit")
|
21 |
if clicked:
|
22 |
-
results =
|
23 |
st.json(results)
|
24 |
|
25 |
if __name__ == "__main__":
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers.pipelines import pipeline
|
3 |
+
from transformers.modeling_auto import AutoModelForQuestionAnswering
|
4 |
+
from transformers.tokenization_auto import AutoTokenizer
|
5 |
|
6 |
+
# b) Load model & tokenizer
|
7 |
+
#model = AutoModelForQuestionAnswering.from_pretrained(model_name)
|
8 |
+
#tokenizer = AutoTokenizer.from_pretrained(model_name)
|
9 |
|
10 |
+
#classifier = pipeline("question-answering", model="deepset/roberta-base-squad2")
|
|
|
|
|
11 |
|
12 |
+
#model_name = "deepset/xlm-roberta-base-squad2"
|
13 |
+
#nlp = pipeline('question-answering', model=model_name, tokenizer=model_name)
|
14 |
+
#QA_input = {
|
15 |
+
# 'question': 'Why is model conversion important?',
|
16 |
+
# 'context': 'The option to convert models between FARM and transformers gives freedom to the user and let people easily switch between frameworks.'
|
17 |
+
#}
|
18 |
+
#res = nlp(QA_input)
|
19 |
|
|
|
20 |
def main():
|
21 |
st.title("Question & Answering")
|
22 |
|
23 |
with st.form("text_field"):
|
24 |
+
sentence_1= st.text_area('Enter Q1:')
|
25 |
+
sentence_2= st.text_area('Enter Q2:')
|
26 |
+
QA_input = {'question':sentence_1, 'context':sentence_2}
|
27 |
+
#clicked==True only when the button is clicked
|
28 |
clicked = st.form_submit_button("Submit")
|
29 |
if clicked:
|
30 |
+
results = nlp(QA_input)
|
31 |
st.json(results)
|
32 |
|
33 |
if __name__ == "__main__":
|