Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import re
|
|
5 |
import torch
|
6 |
from transformers import AutoModelForSequenceClassification
|
7 |
from transformers import BertTokenizerFast
|
|
|
8 |
|
9 |
st.set_page_config(
|
10 |
page_title="detoxi.ai",
|
@@ -34,7 +35,7 @@ class ModelWrapper(object):
|
|
34 |
ModelWrapper.MODELS_DIR + ModelWrapper.MODEL_NAME, torchscript=True
|
35 |
)
|
36 |
self.tokenizer = BertTokenizerFast.from_pretrained(
|
37 |
-
ModelWrapper.MODELS_DIR + ModelWrapper.TOKENIZER,
|
38 |
local_files_only=True
|
39 |
)
|
40 |
self.id2label: dict[int, str] = {0: "__label__positive", 1: "__label__negative"}
|
|
|
5 |
import torch
|
6 |
from transformers import AutoModelForSequenceClassification
|
7 |
from transformers import BertTokenizerFast
|
8 |
+
from pathlib import Path
|
9 |
|
10 |
st.set_page_config(
|
11 |
page_title="detoxi.ai",
|
|
|
35 |
ModelWrapper.MODELS_DIR + ModelWrapper.MODEL_NAME, torchscript=True
|
36 |
)
|
37 |
self.tokenizer = BertTokenizerFast.from_pretrained(
|
38 |
+
str(Path(ModelWrapper.MODELS_DIR + ModelWrapper.TOKENIZER).absolute()),
|
39 |
local_files_only=True
|
40 |
)
|
41 |
self.id2label: dict[int, str] = {0: "__label__positive", 1: "__label__negative"}
|