public static async Task <Emotion[]> GetEmotionResultsFromMediaFile(MediaFile mediaFile, bool disposeMediaFile) { Device.BeginInvokeOnMainThread(() => Application.Current.MainPage.IsBusy = true); try { using (var handle = Insights.TrackTime(InsightsConstants.AnalyzeEmotion)) return(await EmotionClient.RecognizeAsync(MediaService.GetPhotoStream(mediaFile, disposeMediaFile))); } finally { Device.BeginInvokeOnMainThread(() => Application.Current.MainPage.IsBusy = false); } }
public static async Task <Emotion[]> GetEmotionResultsFromMediaFile(MediaFile mediaFile, bool disposeMediaFile) { using (var handle = Insights.TrackTime(InsightsConstants.AnalyzeEmotion)) return(await EmotionClient.RecognizeAsync(MediaService.GetPhotoStream(mediaFile, disposeMediaFile)).ConfigureAwait(false)); }
public static async Task <List <Emotion> > GetEmotionResultsFromMediaFile(MediaFile mediaFile, bool disposeMediaFile) { Device.BeginInvokeOnMainThread(() => Application.Current.MainPage.IsBusy = true); try { using (var handle = AnalyticsHelpers.TrackTime(AnalyticsConstants.AnalyzeEmotion)) { var faceApiResponseList = await FaceApiClient.Face.DetectWithStreamAsync(MediaService.GetPhotoStream(mediaFile, disposeMediaFile), returnFaceAttributes : new List <FaceAttributeType> { { FaceAttributeType.Emotion } }).ConfigureAwait(false); return(faceApiResponseList.Select(x => x.FaceAttributes.Emotion).ToList()); } } finally { Device.BeginInvokeOnMainThread(() => Application.Current.MainPage.IsBusy = false); } }
public static async Task <List <Emotion> > GetEmotionResultsFromMediaFile(MediaFile mediaFile, bool disposeMediaFile) { using (var handle = AnalyticsHelpers.TrackTime(AnalyticsConstants.AnalyzeEmotion)) { var faceApiResponseList = await FaceApiClient.Face.DetectWithStreamAsync(MediaService.GetPhotoStream(mediaFile, disposeMediaFile), returnFaceAttributes : new List <FaceAttributeType> { { FaceAttributeType.Emotion } }).ConfigureAwait(false); return(faceApiResponseList.Select(x => x.FaceAttributes.Emotion).ToList()); } }