Update app.py
Browse files
app.py
CHANGED
@@ -19,14 +19,16 @@ def generate_paraphrase(text, temperature):
|
|
19 |
result = paraphrase_pipeline(
|
20 |
text,
|
21 |
temperature=temperature,
|
22 |
-
max_length=2048, # π
|
23 |
-
|
24 |
top_k=50,
|
|
|
25 |
do_sample=True,
|
26 |
-
repetition_penalty=1.
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
30 |
)
|
31 |
|
32 |
# Extract and format output properly
|
@@ -51,7 +53,7 @@ demo = gr.Interface(
|
|
51 |
gr.Textbox(label="Enter text", placeholder="Type your text to paraphrase...", lines=10), # Bigger input box
|
52 |
gr.Slider(0.5, 1.5, value=1.0, step=0.1, label="Creativity (Temperature)"),
|
53 |
],
|
54 |
-
outputs=gr.Textbox(label="Paraphrased Text", lines=
|
55 |
title="π AI Paraphraser",
|
56 |
description=description,
|
57 |
theme="soft", # β
Fix theme issue
|
|
|
19 |
result = paraphrase_pipeline(
|
20 |
text,
|
21 |
temperature=temperature,
|
22 |
+
max_length=2048, # π Supports long outputs
|
23 |
+
max_new_tokens=1024, # π₯ Ensures full-length output
|
24 |
top_k=50,
|
25 |
+
top_p=0.9, # π― More variation in responses
|
26 |
do_sample=True,
|
27 |
+
repetition_penalty=1.5, # π Stops repetitive loops
|
28 |
+
no_repeat_ngram_size=4, # β Prevents repetitive phrases
|
29 |
+
num_return_sequences=1, # β
Outputs only one high-quality paraphrase
|
30 |
+
num_beams=7, # π Higher number of beams for better sentence flow
|
31 |
+
early_stopping=True
|
32 |
)
|
33 |
|
34 |
# Extract and format output properly
|
|
|
53 |
gr.Textbox(label="Enter text", placeholder="Type your text to paraphrase...", lines=10), # Bigger input box
|
54 |
gr.Slider(0.5, 1.5, value=1.0, step=0.1, label="Creativity (Temperature)"),
|
55 |
],
|
56 |
+
outputs=gr.Textbox(label="Paraphrased Text", lines=30), # π₯ More space for longer output
|
57 |
title="π AI Paraphraser",
|
58 |
description=description,
|
59 |
theme="soft", # β
Fix theme issue
|