Jahadu commited on
Commit
acb15e9
·
verified ·
1 Parent(s): 90da80a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -1,13 +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()
 
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()