Spaces:
Running
Running
Upload 3 files
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
# Load the model
|
5 |
+
generator = pipeline("text2text-generation", model="MBZUAI/LaMini-Flan-T5-783M")
|
6 |
+
|
7 |
+
# Define the function
|
8 |
+
def humanize_text(input_text):
|
9 |
+
if not input_text.strip():
|
10 |
+
return "Please enter some text to humanize."
|
11 |
+
prompt = "Paraphrase this more naturally: " + input_text
|
12 |
+
result = generator(prompt, max_length=256, do_sample=True)
|
13 |
+
return result[0]["generated_text"]
|
14 |
+
|
15 |
+
# Interface to expose /run/predict
|
16 |
+
gr.Interface(
|
17 |
+
fn=humanize_text,
|
18 |
+
inputs=gr.Textbox(lines=6, label="Input Text"),
|
19 |
+
outputs=gr.Textbox(label="Humanized Text"),
|
20 |
+
title="🤖 AI Humanizer",
|
21 |
+
description="Enter AI-generated or robotic text and get a more natural, human-sounding version."
|
22 |
+
).launch()
|