Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ def correct_grammar(text):
|
|
17 |
inputs = tokenizer([text], return_tensors="pt", padding=True, truncation=True, max_length=1024).to(device)
|
18 |
|
19 |
# Generate corrected text with increased max_length and num_beams
|
20 |
-
outputs = model.generate(**inputs, max_length=
|
21 |
|
22 |
# Decode the output and return the corrected text
|
23 |
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
17 |
inputs = tokenizer([text], return_tensors="pt", padding=True, truncation=True, max_length=1024).to(device)
|
18 |
|
19 |
# Generate corrected text with increased max_length and num_beams
|
20 |
+
outputs = model.generate(**inputs, max_length=2024, num_beams=5, early_stopping=True)
|
21 |
|
22 |
# Decode the output and return the corrected text
|
23 |
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|