Update app.py
Browse files
app.py
CHANGED
@@ -2,14 +2,14 @@ import gradio as gr
|
|
2 |
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
3 |
|
4 |
# Load the CoEdIT-xl model and tokenizer
|
5 |
-
tokenizer = AutoTokenizer.from_pretrained("grammarly/coedit-
|
6 |
-
model = T5ForConditionalGeneration.from_pretrained("grammarly/coedit-
|
7 |
|
8 |
def edit_text(input_text):
|
9 |
# Tokenize input text
|
10 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
11 |
# Generate edited text
|
12 |
-
outputs = model.generate(input_ids, max_length=
|
13 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
14 |
return edited_text
|
15 |
|
|
|
2 |
from transformers import AutoTokenizer, T5ForConditionalGeneration
|
3 |
|
4 |
# Load the CoEdIT-xl model and tokenizer
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("grammarly/coedit-xxl")
|
6 |
+
model = T5ForConditionalGeneration.from_pretrained("grammarly/coedit-xxl")
|
7 |
|
8 |
def edit_text(input_text):
|
9 |
# Tokenize input text
|
10 |
input_ids = tokenizer(input_text, return_tensors="pt").input_ids
|
11 |
# Generate edited text
|
12 |
+
outputs = model.generate(input_ids, max_length=1005)
|
13 |
edited_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
14 |
return edited_text
|
15 |
|