Skip to content

Commit

Permalink
Added proper paths for model and tokenizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjanaval committed Jan 20, 2022
1 parent 65c01b2 commit bb0fa91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions iris_emotion/SA_API.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import numpy as np
import pkg_resources
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.sequence import pad_sequences
import pickle
Expand All @@ -11,10 +12,12 @@ def __init__(self):
self.index_to_class = dict((v, k) for k, v in self.class_to_index.items())

# Initialize SA-Model-Final-v8
self.model= load_model('SA_Model_Final_v8')
self.model_path = pkg_resources.resource_filename('iris_emotion', 'SA_Model_Final_v8/')
self.model= load_model(self.model_path)

# Initialize Tokenizer
with open('tokenizer.pickle', 'rb') as handle:
self.tk_path = pkg_resources.resource_filename('iris_emotion', 'tokenizer.pickle')
with open(self.tk_path, 'rb') as handle:
self.tokenizer = pickle.load(handle)

def get_sequences(self, msg):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
name = 'iris_emotion',
packages = ['iris_emotion'],
include_package_data= True,
version = '0.1.0',
version = '0.1.1',
license='MIT',
description = 'Detect emotions in text.',
long_description=long_description,
Expand Down

0 comments on commit bb0fa91

Please sign in to comment.