/// <summary> /// Deserializes the object out of a JSON dynamic object for a certain type. /// </summary> /// <param name="httpClient">the HTTP client</param> /// <param name="type">the type</param> /// <param name="model">the JSON dynamic object of a model</param> /// <returns>the deserialized object</returns> public static Model Deserialize(IClarifaiHttpClient httpClient, Type type, dynamic model) { var typeToDeserialization = new Dictionary <Type, Func <Model> > { { typeof(Color), () => ColorModel.Deserialize(httpClient, model) }, { typeof(Concept), () => ConceptModel.Deserialize(httpClient, model) }, { typeof(Detection), () => DetectionModel.Deserialize(httpClient, model) }, { typeof(Embedding), () => EmbeddingModel.Deserialize(httpClient, model) }, { typeof(FaceEmbedding), () => FaceEmbeddingModel.Deserialize(httpClient, model) }, { typeof(Frame), () => VideoModel.Deserialize(httpClient, model) }, }; if (!typeToDeserialization.ContainsKey(type)) { throw new ClarifaiException(string.Format("Unknown model type: {}", type)); } return(typeToDeserialization[type]()); }
/// <summary> /// Ctor. /// </summary> public PublicModels(IClarifaiHttpClient httpClient) { ColorModel = new ColorModel(httpClient, "eeed0b6733a644cea07cf4c60f87ebb7"); ApparelModel = new ConceptModel(httpClient, "e0be3b9d6a454f0493ac3a30784001ff"); FoodModel = new ConceptModel(httpClient, "bd367be194cf45149e75f01d59f77ba7"); GeneralModel = new ConceptModel(httpClient, "aaa03c23b3724a16a56b629203edc62c"); LandscapeQualityModel = new ConceptModel(httpClient, "bec14810deb94c40a05f1f0eb3c91403"); ModerationModel = new ConceptModel(httpClient, "d16f390eb32cad478c7ae150069bd2c6"); NsfwModel = new ConceptModel(httpClient, "e9576d86d2004ed1a38ba0cf39ecb4b1"); PortraitQualityModel = new ConceptModel(httpClient, "de9bd05cfdbf4534af151beb2a5d0953"); TexturesAndPatternsModel = new ConceptModel(httpClient, "fbefb47f9fdb410e8ce14f24f54b47ff"); TravelModel = new ConceptModel(httpClient, "eee28c313d69466f836ab83287a54ed9"); WeddingModel = new ConceptModel(httpClient, "c386b7a870114f4a87477c0824499348"); DemographicsModel = new DetectionModel(httpClient, "c0c0ac362b03416da06ab3fa36fb58e3"); GeneralEmbeddingModel = new EmbeddingModel(httpClient, "bbb5f41425b8468d9b7a554ff10f8581"); CelebrityModel = new DetectionModel(httpClient, "e466caa0619f444ab97497640cefc4dc"); FaceEmbeddingModel = new FaceEmbeddingModel(httpClient, "e15d0f873e66047e579f90cf82c9882z"); FaceDetectionModel = new DetectionModel(httpClient, "53e1df302c079b3db8a0a36033ed2d15"); LogoModel = new DetectionModel(httpClient, "c443119bf2ed4da98487520d01a0b1e3"); ApparelVideoModel = new VideoModel(httpClient, "e0be3b9d6a454f0493ac3a30784001ff"); FoodVideoModel = new VideoModel(httpClient, "bd367be194cf45149e75f01d59f77ba7"); GeneralVideoModel = new VideoModel(httpClient, "aaa03c23b3724a16a56b629203edc62c"); NsfwVideoModel = new VideoModel(httpClient, "e9576d86d2004ed1a38ba0cf39ecb4b1"); TravelVideoModel = new VideoModel(httpClient, "eee28c313d69466f836ab83287a54ed9"); WeddingVideoModel = new VideoModel(httpClient, "c386b7a870114f4a87477c0824499348"); }