@@ -363,8 +363,9 @@ private void OnDetectFacesResponse(RESTConnector.Request req, RESTConnector.Resp
363
363
/// </summary>
364
364
/// <param name="callback">The callback function that is invoked when the operation completes.</param>
365
365
/// <param name="name">The name of the new classifier. Encode special characters in UTF-8.</param>
366
- /// <param name="positiveExamples">A .zip file of images that depict the visual subject of a class in the new
367
- /// classifier. You can include more than one positive example file in a call.
366
+ /// <param name="positiveExamples">A dictionary that contains the value for each classname. The value is a .zip
367
+ /// file of images that depict the visual subject of a class in the new classifier. You can include more than
368
+ /// one positive example file in a call.
368
369
///
369
370
/// Specify the parameter name by appending `_positive_examples` to the class name. For example,
370
371
/// `goldenretriever_positive_examples` creates the class **goldenretriever**.
@@ -423,7 +424,7 @@ public bool CreateClassifier(Callback<Classifier> callback, string name, Diction
423
424
foreach ( KeyValuePair < string , System . IO . MemoryStream > entry in positiveExamples )
424
425
{
425
426
var partName = string . Format ( "{0}_positive_examples" , entry . Key ) ;
426
- req . Forms [ partName ] = new RESTConnector . Form ( entry . Value , "file .zip", "application/octet-stream" ) ;
427
+ req . Forms [ partName ] = new RESTConnector . Form ( entry . Value , entry . Key + " .zip", "application/octet-stream" ) ;
427
428
}
428
429
}
429
430
if ( negativeExamples != null )
@@ -591,16 +592,19 @@ private void OnGetClassifierResponse(RESTConnector.Request req, RESTConnector.Re
591
592
}
592
593
response . StatusCode = resp . HttpResponseCode ;
593
594
594
- try
595
- {
596
- string json = Encoding . UTF8 . GetString ( resp . Data ) ;
597
- response . Result = JsonConvert . DeserializeObject < Classifier > ( json ) ;
598
- response . Response = json ;
599
- }
600
- catch ( Exception e )
595
+ if ( resp . Success )
601
596
{
602
- Log . Error ( "VisualRecognitionService.OnGetClassifierResponse()" , "Exception: {0}" , e . ToString ( ) ) ;
603
- resp . Success = false ;
597
+ try
598
+ {
599
+ string json = Encoding . UTF8 . GetString ( resp . Data ) ;
600
+ response . Result = JsonConvert . DeserializeObject < Classifier > ( json ) ;
601
+ response . Response = json ;
602
+ }
603
+ catch ( Exception e )
604
+ {
605
+ Log . Error ( "VisualRecognitionService.OnGetClassifierResponse()" , "Exception: {0}" , e . ToString ( ) ) ;
606
+ resp . Success = false ;
607
+ }
604
608
}
605
609
606
610
if ( ( ( RequestObject < Classifier > ) req ) . Callback != null )
@@ -695,9 +699,9 @@ private void OnListClassifiersResponse(RESTConnector.Request req, RESTConnector.
695
699
/// </summary>
696
700
/// <param name="callback">The callback function that is invoked when the operation completes.</param>
697
701
/// <param name="classifierId">The ID of the classifier.</param>
698
- /// <param name="positiveExamples">A .zip file of images that depict the visual subject of a class in the
699
- /// classifier. The positive examples create or update classes in the classifier. You can include more than one
700
- /// positive example file in a call.
702
+ /// <param name="positiveExamples">A dictionary that contains the value for each classname. The value is a .zip
703
+ /// file of images that depict the visual subject of a class in the classifier. The positive examples create or
704
+ /// update classes in the classifier. You can include more than one positive example file in a call.
701
705
///
702
706
/// Specify the parameter name by appending `_positive_examples` to the class name. For example,
703
707
/// `goldenretriever_positive_examples` creates the class `goldenretriever`.
@@ -746,7 +750,7 @@ public bool UpdateClassifier(Callback<Classifier> callback, string classifierId,
746
750
foreach ( KeyValuePair < string , System . IO . MemoryStream > entry in positiveExamples )
747
751
{
748
752
var partName = string . Format ( "{0}_positive_examples" , entry . Key ) ;
749
- req . Forms [ partName ] = new RESTConnector . Form ( entry . Value , "file .zip", "application/octet-stream" ) ;
753
+ req . Forms [ partName ] = new RESTConnector . Form ( entry . Value , entry . Key + " .zip", "application/octet-stream" ) ;
750
754
}
751
755
}
752
756
if ( negativeExamples != null )
0 commit comments