Spaces:
Sleeping
Sleeping
Update src/core_model/predict.py
Browse files- src/core_model/predict.py +11 -11
src/core_model/predict.py
CHANGED
|
@@ -6,18 +6,18 @@ from transformers import XLMRobertaTokenizer, XLMRobertaForSequenceClassificatio
|
|
| 6 |
class MindGuardPredictor:
|
| 7 |
# The __init__ function runs automatically the moment you create a MindGuardPredictor object.
|
| 8 |
def __init__(self, model_path=None):
|
| 9 |
-
|
| 10 |
|
| 11 |
-
#
|
| 12 |
-
#
|
| 13 |
-
self.
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
# --- THE FIX: The English Translation Dictionary ---
|
| 23 |
# Paste the exact dictionary that printed in your Colab terminal here!
|
|
|
|
| 6 |
class MindGuardPredictor:
|
| 7 |
# The __init__ function runs automatically the moment you create a MindGuardPredictor object.
|
| 8 |
def __init__(self, model_path=None):
|
| 9 |
+
self.model_id = "MohitRajput45/mindguard-xlmr"
|
| 10 |
|
| 11 |
+
# If your weights are inside 'final_mindguard_model' folder on HF Hub:
|
| 12 |
+
# Use the subfolder parameter
|
| 13 |
+
self.tokenizer = XLMRobertaTokenizer.from_pretrained(
|
| 14 |
+
self.model_id,
|
| 15 |
+
subfolder="final_mindguard_model"
|
| 16 |
+
)
|
| 17 |
+
self.model = XLMRobertaForSequenceClassification.from_pretrained(
|
| 18 |
+
self.model_id,
|
| 19 |
+
subfolder="final_mindguard_model"
|
| 20 |
+
)
|
| 21 |
|
| 22 |
# --- THE FIX: The English Translation Dictionary ---
|
| 23 |
# Paste the exact dictionary that printed in your Colab terminal here!
|