Spaces:
Running
Running
import streamlit as st | |
from transformers import pipeline | |
st.set_page_config(page_title="AI Grammar Assistant", page_icon="π") | |
st.title("π AI Grammar Assistant") | |
st.write("Enter your text below and get instant grammar corrections!") | |
# Load Hugging Face model | |
def load_model(): | |
return pipeline("text2text-generation", model="vennify/t5-base-grammar-correction") | |
corrector = load_model() | |
user_input = st.text_area("Your text", height=200) | |
if st.button("Correct Grammar"): | |
if user_input.strip() == "": | |
st.warning("β οΈ Please enter some text to correct.") | |
else: | |
with st.spinner("Correcting grammar..."): | |
try: | |
result = corrector(user_input, max_length=128)[0]['generated_text'] | |
st.success("β Corrected Text:") | |
st.write(result) | |
except Exception as e: | |
st.error(f"Something went wrong: {e}") | |
st.markdown("---") | |
st.markdown("Made by [Wanshika Patro](https://github.com/wanshika)") | |