ColeGuion commited on
Commit
ad8550a
1 Parent(s): 4fe4bcb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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("vennify/t5-base-grammar-correction")
6
- tokenizer = AutoTokenizer.from_pretrained("vennify/t5-base-grammar-correction")
7
 
8
 
9
  def correct_text(text, genConfig):
10
- inputs = tokenizer.encode("grammar: " + text, return_tensors="pt")
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)