Update app.py
Browse files
app.py
CHANGED
@@ -19,16 +19,12 @@ def generate_paraphrase(text, temperature):
|
|
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 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
early_stopping=True
|
32 |
)
|
33 |
|
34 |
# Extract and format output properly
|
@@ -53,10 +49,10 @@ demo = gr.Interface(
|
|
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=
|
57 |
title="π AI Paraphraser",
|
58 |
description=description,
|
59 |
-
theme="
|
60 |
live=True,
|
61 |
)
|
62 |
|
|
|
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 |
+
early_stopping=False, # β Prevents early cutoff
|
27 |
+
num_return_sequences=1 # β
Ensures a single, complete paraphrase
|
|
|
28 |
)
|
29 |
|
30 |
# Extract and format output properly
|
|
|
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=20), # π₯ Expands output display
|
53 |
title="π AI Paraphraser",
|
54 |
description=description,
|
55 |
+
theme="huggingface",
|
56 |
live=True,
|
57 |
)
|
58 |
|