File size: 2,249 Bytes
5bc1e2d
5469939
 
 
5bc1e2d
5469939
 
 
 
5bc1e2d
5469939
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5bc1e2d
5469939
5bc1e2d
5469939
 
 
 
 
 
5bc1e2d
5469939
5bc1e2d
5469939
 
 
 
 
5bc1e2d
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# app.py
import streamlit as st
from transformers import pipeline
from langdetect import detect
from gingerit.gingerit import GingerIt

# Initialize models
summarizer = pipeline("summarization")
translator = pipeline("translation", model="Helsinki-NLP/opus-mt-en-ur")
corrector = GingerIt()

st.set_page_config(page_title="CSS AI Assistant by Komal", layout="wide")

st.title("πŸ“š CSS AI Assistant πŸ‡΅πŸ‡°")
st.write("Helping students with news summaries, precis, essays & more β€” for free!")

menu = st.sidebar.radio("Select Feature", [
    "Daily News Summary",
    "Precis Evaluation",
    "Essay Feedback",
    "Saved Notes"
])

# --- Daily News Summary ---
if menu == "Daily News Summary":
    st.header("πŸ“° AI-Powered News Summarizer")
    user_news = st.text_area("Paste or write today's news:", height=200)
    lang = st.radio("Language", ["English", "Urdu"])

    if st.button("Summarize") and user_news:
        summary = summarizer(user_news, max_length=100, min_length=30, do_sample=False)[0]['summary_text']
        if lang == "Urdu":
            translation = translator(summary)[0]['translation_text']
            st.success("Summary in Urdu:")
            st.write(translation)
        else:
            st.success("Summary in English:")
            st.write(summary)

# --- Precis Evaluation ---
elif menu == "Precis Evaluation":
    st.header("✍️ Precis Evaluation Tool")
    precis_input = st.text_area("Enter your precis for evaluation:", height=200)
    if st.button("Evaluate Precis") and precis_input:
        result = corrector.parse(precis_input)
        st.success("βœ… Corrected Precis:")
        st.write(result['result'])

# --- Essay Feedback ---
elif menu == "Essay Feedback":
    st.header("πŸ–‹οΈ Essay Evaluation Tool")
    essay_input = st.text_area("Paste your essay here:", height=300)
    if st.button("Evaluate Essay") and essay_input:
        result = corrector.parse(essay_input)
        st.success("βœ… Suggestions:")
        st.write(result['result'])

# --- Saved Notes (Stub) ---
elif menu == "Saved Notes":
    st.header("πŸ’Ύ Saved Notes")
    st.info("Note saving functionality coming soon!")
    st.write("You will be able to store and download your summaries and corrected answers here.")