/// <summary> /// NSFW image classifier /// </summary> /// Classify an image into Not Safe For Work (NSFW)/P**n/Racy content and Safe /// Content. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='imageFile'> /// Image file to perform the operation on. Common file formats such as PNG, /// JPEG are supported. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <ClassifyOKResponse> ClassifyAsync(this INsfw operations, System.IO.Stream imageFile, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.ClassifyWithHttpMessagesAsync(imageFile, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// NSFW image classifier /// </summary> /// Classify an image into Not Safe For Work (NSFW)/P**n/Racy content and Safe /// Content. /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='imageFile'> /// Image file to perform the operation on. Common file formats such as PNG, /// JPEG are supported. /// </param> public static ClassifyOKResponse Classify(this INsfw operations, System.IO.Stream imageFile) { return(Task.Factory.StartNew(s => ((INsfw)s).ClassifyAsync(imageFile), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }