Update api/core/nlp_handler.py
Browse files- api/core/nlp_handler.py +15 -4
api/core/nlp_handler.py
CHANGED
|
@@ -32,12 +32,23 @@ class NLPHandler:
|
|
| 32 |
@staticmethod
|
| 33 |
def load_models():
|
| 34 |
global _model_mbti, _model_emotion
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
if _model_mbti is None and os.path.exists(MBTI_PATH):
|
| 36 |
-
try:
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
if _model_emotion is None and os.path.exists(EMOTION_PATH):
|
| 39 |
-
try:
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
@staticmethod
|
| 43 |
def translate_to_english(text):
|
|
|
|
| 32 |
@staticmethod
|
| 33 |
def load_models():
|
| 34 |
global _model_mbti, _model_emotion
|
| 35 |
+
print(f"📂 Loading models from: {BASE_DIR}")
|
| 36 |
+
print(f"📁 MBTI path: {MBTI_PATH} (exists: {os.path.exists(MBTI_PATH)})")
|
| 37 |
+
print(f"📁 Emotion path: {EMOTION_PATH} (exists: {os.path.exists(EMOTION_PATH)})")
|
| 38 |
+
|
| 39 |
if _model_mbti is None and os.path.exists(MBTI_PATH):
|
| 40 |
+
try:
|
| 41 |
+
_model_mbti = joblib.load(MBTI_PATH)
|
| 42 |
+
print("✅ MBTI model loaded successfully")
|
| 43 |
+
except Exception as e:
|
| 44 |
+
print(f"❌ MBTI model load error: {e}")
|
| 45 |
+
|
| 46 |
if _model_emotion is None and os.path.exists(EMOTION_PATH):
|
| 47 |
+
try:
|
| 48 |
+
_model_emotion = joblib.load(EMOTION_PATH)
|
| 49 |
+
print("✅ Emotion model loaded successfully")
|
| 50 |
+
except Exception as e:
|
| 51 |
+
print(f"❌ Emotion model load error: {e}")
|
| 52 |
|
| 53 |
@staticmethod
|
| 54 |
def translate_to_english(text):
|