using Microsoft.ML.OnnxRuntime;

string modelsDir = Path.Combine(AppContext.BaseDirectory, "models");
string[] modelFiles = { "melspectrogram.onnx", "embedding_model.onnx", "alexa.onnx" };

var opts = new SessionOptions
{
    IntraOpNumThreads = 1,
    InterOpNumThreads = 1,
    LogSeverityLevel = OrtLoggingLevel.ORT_LOGGING_LEVEL_ERROR,
};

foreach (var f in modelFiles)
{
    string path = Path.Combine(modelsDir, f);
    Console.WriteLine($"== {f} ==");
    using var session = new InferenceSession(path, opts);
    foreach (var kv in session.InputMetadata)
    {
        var dims = string.Join(",", kv.Value.Dimensions);
        Console.WriteLine($"  input  '{kv.Key}': shape=[{dims}] dtype={kv.Value.ElementType.Name}");
    }
    foreach (var kv in session.OutputMetadata)
    {
        var dims = string.Join(",", kv.Value.Dimensions);
        Console.WriteLine($"  output '{kv.Key}': shape=[{dims}] dtype={kv.Value.ElementType.Name}");
    }
}
Console.WriteLine("All three models loaded.");
