duraad commited on
Commit
1c9f431
1 Parent(s): cf337f4

Updated for paragraph

Browse files
Files changed (1) hide show
  1. src/Demo.py +12 -7
src/Demo.py CHANGED
@@ -1,7 +1,7 @@
1
  import streamlit as st
2
  import pandas as pd
3
 
4
- from api.ioprocess import processInputAndResults, check_and_insert_space
5
  from api.ModelMethods import generate
6
 
7
 
@@ -41,14 +41,17 @@ def main():
41
  # Display the selected example text in a text area
42
  selected_example_text = examples[selected_example_key]
43
 
 
 
44
  # Get user input
45
  user_input = st.text_area("Enter a Nepali Sentence: ", selected_example_text)
46
  if st.button("Check Spelling"):
47
  if user_input:
48
- user_input = check_and_insert_space(user_input)
 
49
  correctedText = generate(selected_model, user_input)
50
  # correctedText = {0: "मेरो देस नेपाल हो।", 1: "मेरो देश नेपाल हो।"}
51
- correctedText = correctedText[0]["sequence"]
52
  # # Perfrom grammer correction
53
  # st.subheader("Corrected Text:")
54
  # st.write([f"{line['score']:.2f}: {line['sequence']}"for line in correctedText])
@@ -56,16 +59,18 @@ def main():
56
  st.warning("Please enter some text to check.")
57
  with right_column:
58
  if correctedText is not None:
59
- st.write("Corrected Text:")
60
  # st.write([f"{line['score']:.2f}: {line['sequence']}" for line in correctedText])
61
 
62
  # df = pd.DataFrame(correctedText, columns=["score", "sequence"])
63
 
64
  # Analyze the input and output
65
- correctedText = check_and_insert_space(correctedText)
66
- result = processInputAndResults(user_input, correctedText)
 
 
67
  st.write(
68
- result,
69
  unsafe_allow_html=True,
70
  )
71
 
 
1
  import streamlit as st
2
  import pandas as pd
3
 
4
+
5
  from api.ModelMethods import generate
6
 
7
 
 
41
  # Display the selected example text in a text area
42
  selected_example_text = examples[selected_example_key]
43
 
44
+ # Paragraph selection
45
+
46
  # Get user input
47
  user_input = st.text_area("Enter a Nepali Sentence: ", selected_example_text)
48
  if st.button("Check Spelling"):
49
  if user_input:
50
+
51
+ # user_input = check_and_insert_space(user_input)
52
  correctedText = generate(selected_model, user_input)
53
  # correctedText = {0: "मेरो देस नेपाल हो।", 1: "मेरो देश नेपाल हो।"}
54
+ # correctedText = correctedText[0]["sequence"]
55
  # # Perfrom grammer correction
56
  # st.subheader("Corrected Text:")
57
  # st.write([f"{line['score']:.2f}: {line['sequence']}"for line in correctedText])
 
59
  st.warning("Please enter some text to check.")
60
  with right_column:
61
  if correctedText is not None:
62
+
63
  # st.write([f"{line['score']:.2f}: {line['sequence']}" for line in correctedText])
64
 
65
  # df = pd.DataFrame(correctedText, columns=["score", "sequence"])
66
 
67
  # Analyze the input and output
68
+ if "span" in correctedText:
69
+ st.write("Corrected Text:")
70
+ else:
71
+ st.write("No errors found:")
72
  st.write(
73
+ correctedText,
74
  unsafe_allow_html=True,
75
  )
76