Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
|
@@ -11,12 +11,12 @@ class ToxicAPI(ls.LitAPI):
|
|
| 11 |
|
| 12 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 13 |
model_name,
|
| 14 |
-
|
| 15 |
trust_remote_code=True,
|
| 16 |
)
|
| 17 |
model = AutoModelForSequenceClassification.from_pretrained(
|
| 18 |
model_name,
|
| 19 |
-
|
| 20 |
trust_remote_code=True,
|
| 21 |
)
|
| 22 |
|
|
@@ -33,7 +33,7 @@ class ToxicAPI(ls.LitAPI):
|
|
| 33 |
return self.pipeline(query)
|
| 34 |
|
| 35 |
def encode_response(self, output):
|
| 36 |
-
return output
|
| 37 |
|
| 38 |
def authorize(self, auth: HTTPAuthorizationCredentials = Depends(HTTPBearer())):
|
| 39 |
if auth.scheme != "Bearer" or auth.credentials != os.getenv("auth_token"):
|
|
|
|
| 11 |
|
| 12 |
tokenizer = AutoTokenizer.from_pretrained(
|
| 13 |
model_name,
|
| 14 |
+
token=os.getenv("HF_TOKEN"),
|
| 15 |
trust_remote_code=True,
|
| 16 |
)
|
| 17 |
model = AutoModelForSequenceClassification.from_pretrained(
|
| 18 |
model_name,
|
| 19 |
+
token=os.getenv("HF_TOKEN"),
|
| 20 |
trust_remote_code=True,
|
| 21 |
)
|
| 22 |
|
|
|
|
| 33 |
return self.pipeline(query)
|
| 34 |
|
| 35 |
def encode_response(self, output):
|
| 36 |
+
return output
|
| 37 |
|
| 38 |
def authorize(self, auth: HTTPAuthorizationCredentials = Depends(HTTPBearer())):
|
| 39 |
if auth.scheme != "Bearer" or auth.credentials != os.getenv("auth_token"):
|