Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
6 |
|
7 |
# Initialize models
|
8 |
summarizer = pipeline("summarization")
|
9 |
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur")
|
10 |
-
corrector =
|
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 |
-
|
46 |
-
corrected = language_tool_python.utils.correct(precis_input, matches)
|
47 |
st.success("β
Corrected Precis:")
|
48 |
-
st.write(
|
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 |
-
|
59 |
-
corrected = language_tool_python.utils.correct(essay_input, matches)
|
60 |
st.success("β
Suggestions:")
|
61 |
-
st.write(
|
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.")
|