humanizer_model / app.py
lucidmorto's picture
feat: replace client API with direct model inference
6d02da4
raw
history blame contribute delete
778 Bytes
import gradio as gr
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load the model and tokenizer
model = AutoModelForCausalLM.from_pretrained("umutbozdag/autotrain-g39vl-h3lir")
tokenizer = AutoTokenizer.from_pretrained("umutbozdag/autotrain-g39vl-h3lir")
def generate_text(input_text):
# Tokenize input and generate text
inputs = tokenizer(input_text, return_tensors="pt")
outputs = model.generate(**inputs, max_length=100)
return tokenizer.decode(outputs[0], skip_special_tokens=True)
iface = gr.Interface(
fn=generate_text,
inputs=gr.Textbox(lines=5, label="Input Text"),
outputs=gr.Textbox(label="Generated Text"),
title="Text Humanizer",
description="Enter text to generate a more human-like version."
)
iface.launch()