예제 #1
0
 /// <summary>
 /// Deserializes a JSON object into a concrete ClarifaiInput instance.
 /// It's either ClarifaiURLImage or ClarifaiURLVideo.
 /// </summary>
 /// <param name="jsonObject">the JSON object</param>
 /// <returns>a new ClarifaiInput instance</returns>
 public static ClarifaiInput Deserialize(dynamic jsonObject)
 {
     if (jsonObject.data.image != null)
     {
         if (jsonObject.data.image.base64 != null)
         {
             return(ClarifaiFileImage.Deserialize(jsonObject));
         }
         else
         {
             return(ClarifaiURLImage.Deserialize(jsonObject));
         }
     }
     else if (jsonObject.data.video != null)
     {
         if (jsonObject.data.video.base64 != null)
         {
             return(ClarifaiFileVideo.Deserialize(jsonObject));
         }
         else
         {
             return(ClarifaiURLVideo.Deserialize(jsonObject));
         }
     }
     else
     {
         throw new ClarifaiException(
                   string.Format("Unknown ClarifaiInput json response: {0}", jsonObject));
     }
 }
예제 #2
0
 private bool Equals(ClarifaiFileImage other)
 {
     return(base.Equals(other) && Equals(_bytes, other._bytes) && Equals(Crop, other.Crop));
 }