File size: 513 Bytes
501414a
 
 
3a98369
 
501414a
4c121be
3a98369
 
501414a
4c121be
 
1
2
3
4
5
6
7
8
9
10
11
12
13
import gradio as gr
from transformers import pipeline

# Swap in a grammar-correction model
pipe = pipeline("text2text-generation", model="vennify/t5-base-grammar-correction")

def respond(prompt):
    result = pipe(prompt, max_new_tokens=100)[0]['generated_text']
    return f"Revised Essay:\n{result}\n\nExplanation:\nThe model corrected grammar, punctuation, and style based on typical English writing conventions."

gr.Interface(fn=respond, inputs="text", outputs="text", title="Free AI Essay Bot").launch()