Spaces:
Sleeping
Sleeping
Update api.py
Browse files
api.py
CHANGED
|
@@ -4,16 +4,26 @@ from PIL import Image
|
|
| 4 |
import io
|
| 5 |
import tensorflow as tf
|
| 6 |
import os
|
| 7 |
-
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
|
|
|
| 10 |
hf_token = os.getenv("HF_TOKEN")
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
-
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 15 |
|
| 16 |
-
tokenizer = AutoTokenizer.from_pretrained("chillies/distilbert-course-review-classification")
|
| 17 |
# from transformers import DistilBertTokenizer
|
| 18 |
|
| 19 |
# tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|
|
|
|
| 4 |
import io
|
| 5 |
import tensorflow as tf
|
| 6 |
import os
|
| 7 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 8 |
+
# # os.environ['HF_TOKEN']=''
|
| 9 |
+
# from huggingface_hub import login
|
| 10 |
+
|
| 11 |
+
# hf_token = os.getenv("HF_TOKEN")
|
| 12 |
+
# login(token=hf_token)
|
| 13 |
+
|
| 14 |
|
| 15 |
+
# Read token from environment
|
| 16 |
hf_token = os.getenv("HF_TOKEN")
|
| 17 |
+
|
| 18 |
+
# Load tokenizer directly with the token (no login)
|
| 19 |
+
tokenizer = AutoTokenizer.from_pretrained(
|
| 20 |
+
"chillies/distilbert-course-review-classification",
|
| 21 |
+
token=hf_token # Pass it directly
|
| 22 |
+
)
|
| 23 |
|
| 24 |
|
|
|
|
| 25 |
|
| 26 |
+
# tokenizer = AutoTokenizer.from_pretrained("chillies/distilbert-course-review-classification")
|
| 27 |
# from transformers import DistilBertTokenizer
|
| 28 |
|
| 29 |
# tokenizer = DistilBertTokenizer.from_pretrained("distilbert-base-uncased")
|