Laiba02 commited on
Commit
c59e29b
·
verified ·
1 Parent(s): 7b7d6a6

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+
4
+ # Load the paraphrasing pipeline
5
+ paraphraser = pipeline("text2text-generation", model="Vamsi/T5_Paraphrase_Paws")
6
+
7
+ # Define a function that calls the model
8
+ def paraphrase_text(text):
9
+ result = paraphraser(
10
+ text,
11
+ max_length=128,
12
+ do_sample=True,
13
+ top_k=120,
14
+ num_return_sequences=1
15
+ )
16
+ return result[0]['generated_text']
17
+
18
+ # Create a Gradio interface
19
+ iface = gr.Interface(
20
+ fn=paraphrase_text,
21
+ inputs=gr.Textbox(lines=6, placeholder="Paste your AI-generated text here..."),
22
+ outputs="text",
23
+ title="AI Text Humanizer",
24
+ description="Make AI-generated text sound more human-like using T5 paraphraser.",
25
+ theme="compact"
26
+ )
27
+
28
+ # Launch the app
29
+ iface.launch()