Upload 2 files
Browse files- model.pkl +3 -0
- model_wrapper.py +17 -0
model.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b4916c0201c517027ee48f6603da537b31c283b9aecdec9a1425c86f8e713614
|
| 3 |
+
size 1548814
|
model_wrapper.py
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# model_wrapper.py
|
| 2 |
+
|
| 3 |
+
import joblib
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
LABELS = ['admiration','anger','disgust','fear','hope',
|
| 7 |
+
'joy','love','pride','sadness']
|
| 8 |
+
|
| 9 |
+
class MyModel:
|
| 10 |
+
def __init__(self):
|
| 11 |
+
bundle = joblib.load("model.pkl")
|
| 12 |
+
self.vectorizer = bundle["vectorizer"]
|
| 13 |
+
self.classifier = bundle["classifier"]
|
| 14 |
+
|
| 15 |
+
def predict(self, texts):
|
| 16 |
+
X = self.vectorizer.transform(texts)
|
| 17 |
+
return self.classifier.predict(X)
|