Spaces:
Sleeping
Sleeping
File size: 708 Bytes
0129c4f e5894b7 0ff1c96 0129c4f 0ff1c96 0129c4f 917c41b 0129c4f 917c41b 0129c4f 0ff1c96 0129c4f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
from transformers import pipeline
import streamlit as st
# Load grammar correction model
@st.cache_resource
def load_model():
return pipeline("text2text-generation", model="vennify/t5-base-grammar-correction")
corrector = load_model()
# Streamlit UI
st.title("Grammar Correction Assistant")
user_input = st.text_area("Enter a sentence to correct:", "She don't like going to the gym because it make her tired.")
if st.button("Correct Sentence"):
with st.spinner("Correcting..."):
result = corrector(user_input, max_length=100, clean_up_tokenization_spaces=True)
corrected_sentence = result[0]['generated_text']
st.markdown(f"**Corrected Sentence:** {corrected_sentence}")
|