komalphulpoto commited on
Commit
5bc1e2d
Β·
verified Β·
1 Parent(s): 3fa7fe4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -16
app.py CHANGED
@@ -1,13 +1,13 @@
1
-
2
  import streamlit as st
3
  from transformers import pipeline
4
  from langdetect import detect
5
- import language_tool_python
6
 
7
  # Initialize models
8
  summarizer = pipeline("summarization")
9
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur")
10
- corrector = language_tool_python.LanguageTool('en-US')
11
 
12
  st.set_page_config(page_title="CSS AI Assistant by Komal", layout="wide")
13
 
@@ -42,29 +42,21 @@ elif menu == "Precis Evaluation":
42
  st.header("✍️ Precis Evaluation Tool")
43
  precis_input = st.text_area("Enter your precis for evaluation:", height=200)
44
  if st.button("Evaluate Precis") and precis_input:
45
- matches = corrector.check(precis_input)
46
- corrected = language_tool_python.utils.correct(precis_input, matches)
47
  st.success("βœ… Corrected Precis:")
48
- st.write(corrected)
49
- st.warning("⚠️ Mistakes Highlighted:")
50
- for m in matches:
51
- st.write(f"- {m.ruleId}: {m.message} (at position {m.offset})")
52
 
53
  # --- Essay Feedback ---
54
  elif menu == "Essay Feedback":
55
  st.header("πŸ–‹οΈ Essay Evaluation Tool")
56
  essay_input = st.text_area("Paste your essay here:", height=300)
57
  if st.button("Evaluate Essay") and essay_input:
58
- matches = corrector.check(essay_input)
59
- corrected = language_tool_python.utils.correct(essay_input, matches)
60
  st.success("βœ… Suggestions:")
61
- st.write(corrected)
62
- st.info(f"πŸ” {len(matches)} grammar/style issues found.")
63
- for m in matches:
64
- st.write(f"- {m.message} (Rule: {m.ruleId})")
65
 
66
  # --- Saved Notes (Stub) ---
67
  elif menu == "Saved Notes":
68
  st.header("πŸ’Ύ Saved Notes")
69
  st.info("Note saving functionality coming soon!")
70
- st.write("You will be able to store and download your summaries and corrected answers here.")
 
1
+ # app.py
2
  import streamlit as st
3
  from transformers import pipeline
4
  from langdetect import detect
5
+ from gingerit.gingerit import GingerIt
6
 
7
  # Initialize models
8
  summarizer = pipeline("summarization")
9
  translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur")
10
+ corrector = GingerIt()
11
 
12
  st.set_page_config(page_title="CSS AI Assistant by Komal", layout="wide")
13
 
 
42
  st.header("✍️ Precis Evaluation Tool")
43
  precis_input = st.text_area("Enter your precis for evaluation:", height=200)
44
  if st.button("Evaluate Precis") and precis_input:
45
+ result = corrector.parse(precis_input)
 
46
  st.success("βœ… Corrected Precis:")
47
+ st.write(result['result'])
 
 
 
48
 
49
  # --- Essay Feedback ---
50
  elif menu == "Essay Feedback":
51
  st.header("πŸ–‹οΈ Essay Evaluation Tool")
52
  essay_input = st.text_area("Paste your essay here:", height=300)
53
  if st.button("Evaluate Essay") and essay_input:
54
+ result = corrector.parse(essay_input)
 
55
  st.success("βœ… Suggestions:")
56
+ st.write(result['result'])
 
 
 
57
 
58
  # --- Saved Notes (Stub) ---
59
  elif menu == "Saved Notes":
60
  st.header("πŸ’Ύ Saved Notes")
61
  st.info("Note saving functionality coming soon!")
62
+ st.write("You will be able to store and download your summaries and corrected answers here.")