Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -209,11 +209,6 @@ def correct_spelling(text):
|
|
| 209 |
return ' '.join(corrected_words)
|
| 210 |
|
| 211 |
|
| 212 |
-
# Use the grammar correction pipeline
|
| 213 |
-
pipe = pipeline("text2text-generation", model="pszemraj/flan-t5-large-grammar-synthesis")
|
| 214 |
-
|
| 215 |
-
# Existing imports and setup...
|
| 216 |
-
|
| 217 |
def paraphrase_and_correct(text):
|
| 218 |
paragraphs = text.split("\n\n") # Split by paragraphs
|
| 219 |
|
|
@@ -230,15 +225,11 @@ def paraphrase_and_correct(text):
|
|
| 230 |
paraphrased_text = correct_tense_errors(paraphrased_text)
|
| 231 |
paraphrased_text = ensure_subject_verb_agreement(paraphrased_text)
|
| 232 |
paraphrased_text = fix_punctuation_spacing(paraphrased_text)
|
| 233 |
-
|
| 234 |
-
# Final grammar correction using the pipeline
|
| 235 |
-
grammar_corrected = pipe(paraphrased_text)[0]['generated_text']
|
| 236 |
-
processed_paragraphs.append(grammar_corrected)
|
| 237 |
|
| 238 |
return "\n\n".join(processed_paragraphs) # Reassemble the text with paragraphs
|
| 239 |
|
| 240 |
|
| 241 |
-
|
| 242 |
# Gradio app setup
|
| 243 |
with gr.Blocks() as demo:
|
| 244 |
with gr.Tab("AI Detection"):
|
|
|
|
| 209 |
return ' '.join(corrected_words)
|
| 210 |
|
| 211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 212 |
def paraphrase_and_correct(text):
|
| 213 |
paragraphs = text.split("\n\n") # Split by paragraphs
|
| 214 |
|
|
|
|
| 225 |
paraphrased_text = correct_tense_errors(paraphrased_text)
|
| 226 |
paraphrased_text = ensure_subject_verb_agreement(paraphrased_text)
|
| 227 |
paraphrased_text = fix_punctuation_spacing(paraphrased_text)
|
| 228 |
+
processed_paragraphs.append(paraphrased_text)
|
|
|
|
|
|
|
|
|
|
| 229 |
|
| 230 |
return "\n\n".join(processed_paragraphs) # Reassemble the text with paragraphs
|
| 231 |
|
| 232 |
|
|
|
|
| 233 |
# Gradio app setup
|
| 234 |
with gr.Blocks() as demo:
|
| 235 |
with gr.Tab("AI Detection"):
|