Update app.py
Browse files
app.py
CHANGED
@@ -69,7 +69,7 @@ def summarize_documents(text_input):
|
|
69 |
# Tokenize input text for the model
|
70 |
inputs = tokenizer(text_input, return_tensors="pt", truncation=True, max_length=512)
|
71 |
# Generate a summary with the model
|
72 |
-
summary_ids = model.generate(inputs['input_ids'], max_length=
|
73 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
74 |
|
75 |
summary = re.sub(r"(\w+)([?!])\s", r"\1\2. ", summary) # Ensures that sentences ending in ? ! .
|
|
|
69 |
# Tokenize input text for the model
|
70 |
inputs = tokenizer(text_input, return_tensors="pt", truncation=True, max_length=512)
|
71 |
# Generate a summary with the model
|
72 |
+
summary_ids = model.generate(inputs['input_ids'], max_length=512, min_length=125, length_penalty=2.0, num_beams=4, early_stopping=True)
|
73 |
summary = tokenizer.decode(summary_ids[0], skip_special_tokens=True)
|
74 |
|
75 |
summary = re.sub(r"(\w+)([?!])\s", r"\1\2. ", summary) # Ensures that sentences ending in ? ! .
|