Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Initialize grammar correction pipeline
|
5 |
+
grammar_corrector = pipeline("text2text-generation", model="prithivida/grammar-error-correcter-v1")
|
6 |
+
|
7 |
+
st.title("Grammar Correction Tool")
|
8 |
+
st.write("Correct grammatical errors in your text.")
|
9 |
+
|
10 |
+
text = st.text_area("Enter text with grammatical errors:", placeholder="Type or paste your text here...")
|
11 |
+
if st.button("Correct Grammar"):
|
12 |
+
if not text.strip():
|
13 |
+
st.error("Please provide some text for correction.")
|
14 |
+
else:
|
15 |
+
with st.spinner("Correcting grammar..."):
|
16 |
+
corrected_text = grammar_corrector(text)
|
17 |
+
st.subheader("Corrected Text:")
|
18 |
+
st.write(corrected_text[0]["generated_text"])
|