Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
+
|
4 |
+
def humanize(text):
|
5 |
+
# Step 1: Paraphrase AI text
|
6 |
+
paraphraser = pipeline("text2text-generation", model="facebook/bart-large-cnn")
|
7 |
+
paraphrased = paraphraser(text, max_length=1000)[0]['generated_text']
|
8 |
+
|
9 |
+
# Step 2: Make it sound human
|
10 |
+
human_text = paraphrased.replace(" however", " but hey").replace(". ", ". Seriously, ") + " 😊"
|
11 |
+
return human_text
|
12 |
+
|
13 |
+
gr.Interface(fn=humanize, inputs="textbox", outputs="textbox").launch()
|