Spaces:
Sleeping
Sleeping
Update app.py
Browse filesCatch error when target word is not used
app.py
CHANGED
@@ -116,6 +116,8 @@ st.subheader("Form your sentence and input below!")
|
|
116 |
sentence = st.text_input('Enter your sentence here', placeholder="Enter your sentence here!")
|
117 |
|
118 |
if st.button("Grade"):
|
|
|
|
|
119 |
top_k_prediction, score = assess_sentence(target_word, sentence)
|
120 |
with open('./result01.json', 'w') as outfile:
|
121 |
outfile.write(str(top_k_prediction))
|
|
|
116 |
sentence = st.text_input('Enter your sentence here', placeholder="Enter your sentence here!")
|
117 |
|
118 |
if st.button("Grade"):
|
119 |
+
if sentence.find(target_word) == -1:
|
120 |
+
st.error("Error: Sentence must include the target word!")
|
121 |
top_k_prediction, score = assess_sentence(target_word, sentence)
|
122 |
with open('./result01.json', 'w') as outfile:
|
123 |
outfile.write(str(top_k_prediction))
|