Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,12 @@ import gradio as gr
|
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig
|
3 |
|
4 |
# Load the model and tokenizer
|
5 |
-
model = AutoModelForSeq2SeqLM.from_pretrained("
|
6 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
7 |
|
8 |
|
9 |
def correct_text(text, genConfig):
|
10 |
-
inputs = tokenizer.encode("
|
11 |
outputs = model.generate(inputs, **genConfig.to_dict())
|
12 |
|
13 |
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
|
|
2 |
from transformers import AutoModelForSeq2SeqLM, AutoTokenizer, GenerationConfig
|
3 |
|
4 |
# Load the model and tokenizer
|
5 |
+
model = AutoModelForSeq2SeqLM.from_pretrained("pszemraj/flan-t5-large-grammar-synthesis")
|
6 |
+
tokenizer = AutoTokenizer.from_pretrained("pszemraj/flan-t5-large-grammar-synthesis")
|
7 |
|
8 |
|
9 |
def correct_text(text, genConfig):
|
10 |
+
inputs = tokenizer.encode("" + text, return_tensors="pt")
|
11 |
outputs = model.generate(inputs, **genConfig.to_dict())
|
12 |
|
13 |
corrected_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|