Update app/utils/predict_afteruse.py
Browse files
app/utils/predict_afteruse.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import torch
|
| 2 |
from transformers import BertTokenizer, BertForSequenceClassification
|
| 3 |
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
-
# Load model dan tokenizer multi-label
|
| 6 |
-
tokenizer = BertTokenizer.from_pretrained(r"D:\python\pythonProject\skicare_analyze\bert-safe-multilabel", local_files_only=True)
|
| 7 |
-
model = BertForSequenceClassification.from_pretrained(r"D:\python\pythonProject\skicare_analyze\bert-safe-multilabel", local_files_only=True)
|
| 8 |
model.eval()
|
| 9 |
|
| 10 |
# Efek after use (harus sesuai saat training)
|
|
|
|
| 1 |
import torch
|
| 2 |
from transformers import BertTokenizer, BertForSequenceClassification
|
| 3 |
import numpy as np
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 7 |
+
|
| 8 |
+
# Load the pre-trained model and tokenizer
|
| 9 |
+
tokenizer = BertTokenizer.from_pretrained("Maulidaaa/bert-safe-multilabel", token=HF_TOKEN)
|
| 10 |
+
model = BertForSequenceClassification.from_pretrained("Maulidaaa/bert-safe-multilabel", token=HF_TOKEN)
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
model.eval()
|
| 13 |
|
| 14 |
# Efek after use (harus sesuai saat training)
|