alexpap commited on
Commit
e4379f8
1 Parent(s): c544217

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -1
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import streamlit as st
 
2
 
3
  st.title('Question-Answering NLU')
4
 
@@ -42,4 +43,31 @@ question-answering data that can be used by QANLU. MATIS++ includes
42
  the original English version of ATIS and a translation into eight languages: German, Spanish, French,
43
  Japanese, Hindi, Portuguese, Turkish, and Chinese.
44
 
45
- ''')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import streamlit as st
2
+ from transformers import AutoTokenizer, AutoModelForQuestionAnswering, pipeline
3
 
4
  st.title('Question-Answering NLU')
5
 
43
  the original English version of ATIS and a translation into eight languages: German, Spanish, French,
44
  Japanese, Hindi, Portuguese, Turkish, and Chinese.
45
 
46
+ ''')
47
+
48
+ elif menu == "Evaluation":
49
+ st.header('QANLU Evaluation')
50
+ tokenizer = AutoTokenizer.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
51
+
52
+ model = AutoModelForQuestionAnswering.from_pretrained("AmazonScience/qanlu", use_auth_token=True)
53
+
54
+ qa_pipeline = pipeline('question-answering', model=model, tokenizer=tokenizer)
55
+
56
+ context = st.text_input(
57
+ 'Please enter the context:',
58
+ value="I want a cheap flight to Boston."
59
+ )
60
+ question = st.text_input(
61
+ 'Please enter the question:',
62
+ value="What is the destination?"
63
+ )
64
+
65
+
66
+ qa_input = {
67
+ 'context': 'Yes. No. ' + context,
68
+ 'question': question
69
+ }
70
+
71
+ if st.button('Ask QANLU'):
72
+ answer = qa_pipeline(qa_input)
73
+ st.write(answer)