Spaces:
Sleeping
Sleeping
app.py
CHANGED
@@ -62,9 +62,10 @@ def summarize_text(input_text, model_label, char_limit):
|
|
62 |
|
63 |
summary_ids = model.generate(
|
64 |
input_ids,
|
65 |
-
max_length=
|
66 |
min_length=10,
|
67 |
-
do_sample=False
|
|
|
68 |
)
|
69 |
|
70 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
@@ -76,7 +77,7 @@ iface = gr.Interface(
|
|
76 |
inputs=[
|
77 |
gr.Textbox(lines=6, label="Enter text to summarize"),
|
78 |
gr.Dropdown(choices=list(model_choices.keys()), label="Choose summarization model", value="DistilBART CNN (sshleifer/distilbart-cnn-12-6)"),
|
79 |
-
gr.Slider(minimum=30, maximum=200, value=
|
80 |
],
|
81 |
outputs=gr.Textbox(lines=3, label="Summary (truncated to character limit)"),
|
82 |
title="🔥 Fast Summarizer (GPU-Optimized)",
|
|
|
62 |
|
63 |
summary_ids = model.generate(
|
64 |
input_ids,
|
65 |
+
max_length=20,
|
66 |
min_length=10,
|
67 |
+
do_sample=False,
|
68 |
+
no_repeat_ngram_size=2 # Restrict repetition of bigrams (2-grams)
|
69 |
)
|
70 |
|
71 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
|
|
77 |
inputs=[
|
78 |
gr.Textbox(lines=6, label="Enter text to summarize"),
|
79 |
gr.Dropdown(choices=list(model_choices.keys()), label="Choose summarization model", value="DistilBART CNN (sshleifer/distilbart-cnn-12-6)"),
|
80 |
+
gr.Slider(minimum=30, maximum=200, value=65, step=1, label="Max Character Limit")
|
81 |
],
|
82 |
outputs=gr.Textbox(lines=3, label="Summary (truncated to character limit)"),
|
83 |
title="🔥 Fast Summarizer (GPU-Optimized)",
|