private CustomerEmotionViewModel InitializeViewModelBaseOnEmotionTool(string emotionTool, byte[] data)
 {
     if (emotionTool == EmotionTools.EmotionDetection)
     {
         var response = emotionalRPCClient.SendEmotionDataToServer(data);
         return(mapper.Map <CustomerEmotionViewModel>(response));
     }
     else
     {
         var response = awsRekognition.DetectImage(data);
         return(mapper.Map <CustomerEmotionViewModel>(response));
     }
 }
Example #2
0
        public ActionResult StoreVideo(string base64image, string emotionTool)
        {
            if (string.IsNullOrEmpty(base64image))
            {
                return(Json(new { result = emotionalRPCClient.EmptyEmotionData }, JsonRequestBehavior.AllowGet));
            }

            var image = base64image.Substring(22);

            byte[] imageInBytes = Convert.FromBase64String(image);

            if (emotionTool == EmotionTools.EmotionDetection)
            {
                var response = emotionalRPCClient.SendEmotionDataToServer(imageInBytes);

                return(Json(new { result = response }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var response = awsRekognition.DetectImage(imageInBytes);

                return(Json(new { result = response }, JsonRequestBehavior.AllowGet));
            }
        }