vikigitonga11 commited on
Commit
2f21018
Β·
verified Β·
1 Parent(s): 721f130

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -10
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
- 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,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=30), # πŸ”₯ More space for longer output
57
  title="πŸ“ AI Paraphraser",
58
  description=description,
59
- theme="soft", # βœ… Fix theme issue
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