Skip to content

Commit

Permalink
upgrade static code
Browse files Browse the repository at this point in the history
  • Loading branch information
vijuSR committed Feb 1, 2019
1 parent a04016c commit a51e144
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/predictor.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,27 @@ def from_cam(sess):
EMOJI_FILE_PATH = os.path.join(os.path.dirname(__file__), os.pardir, 'emoji')
tf.reset_default_graph()

# used to map the output from the prediction to the emotion class
index_emo = {v:k for k,v in EMOTION_MAP.items()}

emoji_to_pic = {
'smile': None,'kiss': None,'tease': None,'angry': None,'glass': None
}
# dictionary of emoji name and the corresponding read image
emoji_to_pic = {k: None for k in EMOTION_MAP.keys()}

files = glob.glob(EMOJI_FILE_PATH + '/*.png')
emoji_png_files_path = os.path.join(EMOJI_FILE_PATH, '*.png')
files = glob.glob(emoji_png_files_path)

logger.info('loading the emoji png files in memory ...')

import platform

if platform.system() == 'Windows':
split_string = '\\'
else:
split_string = '/'

for file in tqdm.tqdm(files):
logger.debug('file path: {}'.format(file))
emoji_to_pic[file.split('/')[-1].split('.')[0]] = cv2.imread(file, -1)
emoji_to_pic[file.split(split_string)[-1].split('.')[0]] = cv2.imread(file, -1)

X = tf.placeholder(
tf.float32, shape=[None, 48, 48, 1]
Expand Down

0 comments on commit a51e144

Please sign in to comment.