Update app.py
Browse files
app.py
CHANGED
@@ -19,12 +19,14 @@ def generate_paraphrase(text, temperature):
|
|
19 |
result = paraphrase_pipeline(
|
20 |
text,
|
21 |
temperature=temperature,
|
|
|
|
|
22 |
top_k=50,
|
23 |
do_sample=True,
|
24 |
-
max_new_tokens=1500, # π Allows much longer outputs
|
25 |
repetition_penalty=1.2, # π Reduces repetition
|
26 |
-
|
27 |
-
|
|
|
28 |
)
|
29 |
|
30 |
# Extract and format output properly
|
@@ -49,10 +51,10 @@ demo = gr.Interface(
|
|
49 |
gr.Textbox(label="Enter text", placeholder="Type your text to paraphrase...", lines=10), # Bigger input box
|
50 |
gr.Slider(0.5, 1.5, value=1.0, step=0.1, label="Creativity (Temperature)"),
|
51 |
],
|
52 |
-
outputs=gr.Textbox(label="Paraphrased Text", lines=
|
53 |
title="π AI Paraphraser",
|
54 |
description=description,
|
55 |
-
theme="
|
56 |
live=True,
|
57 |
)
|
58 |
|
|
|
19 |
result = paraphrase_pipeline(
|
20 |
text,
|
21 |
temperature=temperature,
|
22 |
+
max_length=2048, # π Set max output length (bigger than default limits)
|
23 |
+
min_length=500, # π₯ Ensures longer responses
|
24 |
top_k=50,
|
25 |
do_sample=True,
|
|
|
26 |
repetition_penalty=1.2, # π Reduces repetition
|
27 |
+
num_return_sequences=1, # β
Ensures a single, complete paraphrase
|
28 |
+
num_beams=5, # π Helps generate full-length sentences
|
29 |
+
early_stopping=True # β Stops at a natural sentence end
|
30 |
)
|
31 |
|
32 |
# Extract and format output properly
|
|
|
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=25), # π₯ Even more space for longer output
|
55 |
title="π AI Paraphraser",
|
56 |
description=description,
|
57 |
+
theme="soft", # β
Fix theme issue
|
58 |
live=True,
|
59 |
)
|
60 |
|