Raghavendra0827 commited on
Commit
134c4b3
·
verified ·
1 Parent(s): 396a5b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -41,20 +41,14 @@ def main():
41
  input_text = st.text_input("Enter the Word")
42
  if st.button("Check"):
43
  top_classes, top_probabilities = mat(input_text)
44
- words = input_text.split() # Split input text into words
45
- for word in words:
46
- if len(word) > 0:
47
- st.markdown(f'<span style="color: blue">{word}</span>', unsafe_allow_html=True)
48
- st.write() # Add line break after displaying input text
49
  for i, (class_, probability) in enumerate(zip(top_classes, top_probabilities)):
50
  suggested_word = data[data.Label == class_].Word.values[0]
51
- button_text = f"Did you mean '{suggested_word}'?"
52
- if st.button(button_text):
53
- definition = dataa[dataa['Word'] == suggested_word]['Definition'].values
54
  if len(definition) > 0:
55
- st.markdown(f"The dictionary meaning of '{suggested_word}' is: {definition[0]}")
56
  else:
57
- st.markdown(f"No definition found for '{suggested_word}' in the dictionary.")
58
 
59
  if __name__ == "__main__":
60
  main()
 
41
  input_text = st.text_input("Enter the Word")
42
  if st.button("Check"):
43
  top_classes, top_probabilities = mat(input_text)
 
 
 
 
 
44
  for i, (class_, probability) in enumerate(zip(top_classes, top_probabilities)):
45
  suggested_word = data[data.Label == class_].Word.values[0]
46
+ if st.button(f"Suggested Word: {suggested_word}"):
47
+ definition = dataa[dataa['Word'].str.lower() == suggested_word.lower()]['Definition'].values
 
48
  if len(definition) > 0:
49
+ st.write(f"The dictionary meaning of '{suggested_word}' is: {definition[0]}")
50
  else:
51
+ st.write(f"No definition found for '{suggested_word}' in the dictionary.")
52
 
53
  if __name__ == "__main__":
54
  main()