Humanizo / app.py
mero79's picture
Update app.py
ed79474 verified
import gradio as gr
from transformers import (
AutoTokenizer,
AutoModelForSeq2SeqLM,
pipeline
)
# Load slow (SentencePiece) tokenizer and model
tokenizer = AutoTokenizer.from_pretrained(
"prithivida/parrot_paraphraser_on_T5",
use_fast=False
)
model = AutoModelForSeq2SeqLM.from_pretrained(
"prithivida/parrot_paraphraser_on_T5"
)
# Build your paraphrasing pipeline
paraphrase = pipeline(
"text2text-generation",
model=model,
tokenizer=tokenizer,
device=0 # if you have a GPU; otherwise omit this line
)
def humanize(text):
outputs = paraphrase(
text,
max_length=256,
num_return_sequences=1
)
return outputs[0]["generated_text"]
demo = gr.Interface(
fn=humanize,
inputs=gr.Textbox(lines=5, placeholder="Paste your text here…"),
outputs="text",
title="Humanizo: Humanize AI Text",
description="Enter text and get a more natural, human‑like version."
)
if __name__ == "__main__":
demo.launch()