Dela via


LearningModel.Author Property

Definition

The name of the model author.

public:
 property Platform::String ^ Author { Platform::String ^ get(); };
winrt::hstring Author();
public string Author { get; }
var string = learningModel.author;
Public ReadOnly Property Author As String

Property Value

String

Platform::String

winrt::hstring

The name of the model author.

Examples

The following example loads a model from a local file, outputs the model author to the application's UI, and creates a session from the model.

private async Task LoadModelAsync(string _modelFileName)
{
    LearningModel _model;
    LearningModelSession _session;

    try
    {
        // Load and create the model
        var modelFile = 
            await StorageFile.GetFileFromApplicationUriAsync(new Uri($"ms-appx:///Assets/{_modelFileName}"));
        _model = await LearningModel.LoadFromStorageFileAsync(modelFile);

        //Output the model author to application UI
        StatusBlock.Text = $"Model Author: {_model.Author}";

        // Create the evaluation session with the model
        _session = new LearningModelSession(_model);

    }
    catch (Exception ex)
    {
        StatusBlock.Text = $"error: {ex.Message}";
        _model = null;
    }
}

Remarks

Windows Server

To use this API on Windows Server, you must use Windows Server 2019 with Desktop Experience.

Thread safety

This API is thread-safe.

Applies to