Skip to content

Commit

Permalink
pkl 파일 로드 버그 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
rickiepark committed Jun 3, 2021
1 parent f0f4471 commit 7e26f80
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions ml_editor/model_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@

model_path = Path("../models/model_2.pkl")
vectorizer_path = Path("../models/vectorizer_2.pkl")
VECTORIZER = joblib.load(curr_path / vectorizer_path)
MODEL = joblib.load(curr_path / model_path)
VECTORIZER = None
MODEL = None


def count_each_pos(df):
Expand Down Expand Up @@ -166,7 +166,11 @@ def get_model_probabilities_for_input_texts(text_array):
:param text_array: array of questions to be scored
:return: array of predicted probabilities
"""
global FEATURE_ARR, VECTORIZER, MODEL
global FEATURE_ARR, VECTORIZER, MODEL, curr_path, vectorizer_path, model_path
if VECTORIZER == None:
VECTORIZER = joblib.load(curr_path / vectorizer_path)
if MODEL == None:
MODEL = joblib.load(curr_path / model_path)
vectors = VECTORIZER.transform(text_array)
text_ser = pd.DataFrame(text_array, columns=["full_text"])
text_ser = add_v2_text_features(text_ser.copy())
Expand Down

0 comments on commit 7e26f80

Please sign in to comment.