Update app.py
Browse files
app.py
CHANGED
|
@@ -23,9 +23,9 @@ try:
|
|
| 23 |
except Exception as e:
|
| 24 |
|
| 25 |
|
| 26 |
-
def ai_text(text):
|
| 27 |
-
|
| 28 |
-
|
| 29 |
|
| 30 |
def to_highlight(corrected_sent, errs):
|
| 31 |
output = [{"entity": "糾錯", "word": err[1], "start": err[2], "end": err[3]} for i, err in
|
|
|
|
| 23 |
except Exception as e:
|
| 24 |
|
| 25 |
|
| 26 |
+
def ai_text(text):
|
| 27 |
+
with torch.no_grad():
|
| 28 |
+
outputs = model(**tokenizer([text], padding=True, return_tensors='pt'))
|
| 29 |
|
| 30 |
def to_highlight(corrected_sent, errs):
|
| 31 |
output = [{"entity": "糾錯", "word": err[1], "start": err[2], "end": err[3]} for i, err in
|