Morris
commited on
Commit
·
3225e9b
1
Parent(s):
58b4f03
update app.py
Browse files- app.py +5 -46
- congratulations-meme.jpeg +0 -0
app.py
CHANGED
@@ -9,9 +9,7 @@ subsections = pd.read_csv('subsections.csv')
|
|
9 |
|
10 |
st.title('iTELL Short Answer Scoring Demo')
|
11 |
st.image(Image.open('learlabaialoe.JPG'))
|
12 |
-
st.subheader('This is a demonstration of the iTELL short answer scoring model.')
|
13 |
-
st.subheader('You will be provided with a random passage from a book on Macroeconomics and a question.')
|
14 |
-
st.subheader('Please provide a short answer to the question.')
|
15 |
|
16 |
ind = st.slider('Use this slider to choose your subsection.', min_value=0, max_value=len(subsections))
|
17 |
|
@@ -32,51 +30,12 @@ if student_answer:
|
|
32 |
text = student_answer + '</s>' + answer
|
33 |
res = pipe(text)[0]['label']
|
34 |
if res == 'correct_answer':
|
|
|
35 |
st.write('Yay, you got it right!')
|
36 |
elif res == 'incorrect_answer':
|
37 |
st.write('Nope, you said', student_answer)
|
38 |
st.write('A better answer would have been', answer)
|
39 |
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
# if student_answer == False:
|
45 |
-
|
46 |
-
# row = pd.read_csv('subsections.csv').sample(n=1).reset_index()
|
47 |
-
# passage = row.iloc[0]['clean_text']
|
48 |
-
# question = row.iloc[0]['question']
|
49 |
-
# answer = row.iloc[0]['answer']
|
50 |
-
# st.markdown('## Passage')
|
51 |
-
# st.write(passage)
|
52 |
-
# st.markdown('## Question')
|
53 |
-
# st.write(question)
|
54 |
-
# st.markdown('## Answer')
|
55 |
-
#
|
56 |
-
|
57 |
-
# else:
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
# # student_answer = st.text_input("write your answer")
|
63 |
-
|
64 |
-
# # def generate_random_passage():
|
65 |
-
# # row = pd.read_csv('subsections.csv').sample(n=1).reset_index()
|
66 |
-
# # passage = row.iloc[0]['clean_text']
|
67 |
-
# # question = row.iloc[0]['question']
|
68 |
-
# # answer = row.iloc[0]['answer']
|
69 |
-
# # st.markdown('## Passage')
|
70 |
-
# # st.write(passage)
|
71 |
-
# # st.markdown('## Question')
|
72 |
-
# # st.write(question)
|
73 |
-
# # st.markdown('## Answer')
|
74 |
-
# # student_answer = st.text_input("write your answer")
|
75 |
-
|
76 |
-
# # if student_answer:
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
|
|
9 |
|
10 |
st.title('iTELL Short Answer Scoring Demo')
|
11 |
st.image(Image.open('learlabaialoe.JPG'))
|
12 |
+
st.subheader('This is a demonstration of the iTELL short answer scoring model. You will be provided with a random passage from a book on Macroeconomics and a question. Please provide a short answer to the question.')
|
|
|
|
|
13 |
|
14 |
ind = st.slider('Use this slider to choose your subsection.', min_value=0, max_value=len(subsections))
|
15 |
|
|
|
30 |
text = student_answer + '</s>' + answer
|
31 |
res = pipe(text)[0]['label']
|
32 |
if res == 'correct_answer':
|
33 |
+
st.image(Image.open('congratulations-meme.jpeg'))
|
34 |
st.write('Yay, you got it right!')
|
35 |
elif res == 'incorrect_answer':
|
36 |
st.write('Nope, you said', student_answer)
|
37 |
st.write('A better answer would have been', answer)
|
38 |
|
39 |
+
if st.button('Reset'):
|
40 |
+
student_answer = False
|
41 |
+
ind = False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
congratulations-meme.jpeg
ADDED
![]() |