File size: 730 Bytes
ad9c444
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st
from transformers import pipeline

# Initialize grammar correction pipeline
grammar_corrector = pipeline("text2text-generation", model="prithivida/grammar-error-correcter-v1")

st.title("Grammar Correction Tool")
st.write("Correct grammatical errors in your text.")

text = st.text_area("Enter text with grammatical errors:", placeholder="Type or paste your text here...")
if st.button("Correct Grammar"):
    if not text.strip():
        st.error("Please provide some text for correction.")
    else:
        with st.spinner("Correcting grammar..."):
            corrected_text = grammar_corrector(text)
            st.subheader("Corrected Text:")
            st.write(corrected_text[0]["generated_text"])