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"])