vikigitonga11 commited on
Commit
22f5702
Β·
verified Β·
1 Parent(s): a3286ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
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
- 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,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=20), # πŸ”₯ Expands output display
53
  title="πŸ“ AI Paraphraser",
54
  description=description,
55
- theme="huggingface",
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