MohitRajput45 commited on
Commit
cda171e
·
verified ·
1 Parent(s): 1a4ebd8

Update src/core_model/predict.py

Browse files
Files changed (1) hide show
  1. 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
- print("🧠 Loading MindGuard Core Engine...")
10
 
11
- # 1. THE FIX: Point to your new Model Hub ID
12
- # Replace 'MohitRajput45/mindguard-xlmr' with your actual Model Repo name
13
- self.model_id = "MohitRajput45/mindguard-xlmr"
14
-
15
- print(f"DEBUG: Loading model from Hugging Face Hub: {self.model_id}")
16
-
17
- # 2. LOAD DIRECTLY FROM THE CLOUD
18
- # Streamlit will cache this so it only downloads once!
19
- self.tokenizer = XLMRobertaTokenizer.from_pretrained(self.model_id)
20
- self.model = XLMRobertaForSequenceClassification.from_pretrained(self.model_id)
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!