Spaces:
Sleeping
Sleeping
File size: 706 Bytes
501414a 0be76f4 501414a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import gradio as gr
from transformers import pipeline
# Load the Hugging Face model
pipe = pipeline("text-generation", model="mrm8488/t5-base-finetuned-common_gen")
# Define what the app does
def rewrite(text):
prompt = f"Fix grammar and improve clarity for this text:\n\n{text}"
output = pipe(prompt, max_new_tokens=300, do_sample=True)[0]['generated_text']
return output
# Create the interface
gr.Interface(
fn=rewrite,
inputs=gr.Textbox(lines=10, placeholder="Paste your essay here..."),
outputs=gr.Textbox(lines=10, label="Improved Essay"),
title="AI Essay Rewriter",
description="Paste an essay or paragraph and get an improved version using Mistral-7B."
).launch()
|