-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.py
30 lines (24 loc) · 844 Bytes
/
hello.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
from spell import correction
st.title("hello")
check = st.sidebar.checkbox('Show the original input word')
form = st.form(key='form-name')
selected_word = form.selectbox('Select a word:', ['', 'valubale', 'levels', 'choise', 'extreamly'])
input_word = form.text_input('OR Type your own word!')
submit = form.form_submit_button("Submit")
if check:
if selected_word != '':
st.write("Original input word:", selected_word)
elif input_word != '':
st.write("Original input word:", input_word)
if submit:
word = ""
if (selected_word != ''):
word = selected_word
elif (input_word != ''):
word = input_word
correct = correction(word)
if (word == correct):
st.success(f"{word} is the correct spelling!")
else:
st.error(f"Correction: {correct}")