// </snippet_analyze_response> // <snippet_manage> private static async Task ManageModels( FormRecognizerClient trainingClient, string trainingFileUrl) { // </snippet_manage> // <snippet_manage_model_count> // Check number of models in the FormRecognizer account, // and the maximum number of models that can be stored. AccountProperties accountProperties = trainingClient.GetAccountProperties(); Console.WriteLine($"Account has {accountProperties.CustomModelCount} models."); Console.WriteLine($"It can have at most {accountProperties.CustomModelLimit} models."); // </snippet_manage_model_count> // <snippet_manage_model_list> Pageable <CustomFormModelInfo> models = trainingClient.GetCustomModels(); foreach (CustomFormModelInfo modelInfo in models) { Console.WriteLine($"Custom Model Info:"); Console.WriteLine($" Model Id: {modelInfo.ModelId}"); Console.WriteLine($" Model Status: {modelInfo.Status}"); Console.WriteLine($" Training model started on: {modelInfo.TrainingStartedOn}"); Console.WriteLine($" Training model completed on: {modelInfo.TrainingCompletedOn}"); } // </snippet_manage_model_list> // <snippet_manage_model_get> // Create a new model to store in the account CustomFormModel model = await trainingClient.StartTrainingAsync( new Uri(trainingFileUrl)).WaitForCompletionAsync(); // Get the model that was just created CustomFormModel modelCopy = trainingClient.GetCustomModel(model.ModelId); Console.WriteLine($"Custom Model {modelCopy.ModelId} recognizes the following form types:"); foreach (CustomFormSubmodel submodel in modelCopy.Submodels) { Console.WriteLine($"Submodel Form Type: {submodel.FormType}"); foreach (CustomFormModelField field in submodel.Fields.Values) { Console.Write($" FieldName: {field.Name}"); if (field.Label != null) { Console.Write($", FieldLabel: {field.Label}"); } Console.WriteLine(""); } } // </snippet_manage_model_get> // <snippet_manage_model_delete> // Delete the model from the account. trainingClient.DeleteModel(model.ModelId); }