Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
import gradio as gr
|
2 |
-
from transformers import pipeline
|
3 |
|
4 |
-
def humanize(text):
|
5 |
-
#
|
6 |
-
paraphraser = pipeline("text2text-generation", model="
|
7 |
-
paraphrased = paraphraser(
|
|
|
|
|
|
|
|
|
8 |
|
9 |
-
|
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()
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
+
def humanize(text):
|
5 |
+
# Use a smaller, faster model for testing
|
6 |
+
paraphraser = pipeline("text2text-generation", model="t5-small")
|
7 |
+
paraphrased = paraphraser(
|
8 |
+
f"Make this text sound human: {text}",
|
9 |
+
max_length=1000
|
10 |
+
)[0]['generated_text']
|
11 |
+
return paraphrased.replace(". ", ". ").replace(" however", " but") + " 😊"
|
12 |
|
13 |
+
gr.Interface(fn=humanize, inputs="text", outputs="text").launch()
|
|
|
|
|
|
|
|