Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,7 +8,7 @@ tokenizer = AutoTokenizer.from_pretrained(model_name)
|
|
| 8 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 9 |
|
| 10 |
# Function to correct sentences
|
| 11 |
-
def
|
| 12 |
inputs = tokenizer.encode("correction: " + sentence, return_tensors="pt", max_length=512, truncation=True)
|
| 13 |
outputs = model.generate(inputs, max_length=128, num_beams=4, early_stopping=True)
|
| 14 |
corrected_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
|
| 8 |
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)
|
| 9 |
|
| 10 |
# Function to correct sentences
|
| 11 |
+
def predict(sentence):
|
| 12 |
inputs = tokenizer.encode("correction: " + sentence, return_tensors="pt", max_length=512, truncation=True)
|
| 13 |
outputs = model.generate(inputs, max_length=128, num_beams=4, early_stopping=True)
|
| 14 |
corrected_sentence = tokenizer.decode(outputs[0], skip_special_tokens=True)
|