xr-ai-accelerator

XrAiFactory

The XrAiFactory class serves as the central factory for creating instances of various AI model pipelines in the XR AI Library. It provides static methods to load different types of AI models by name.

Class Declaration

public class XrAiFactory

Methods

LoadImageTo3d

Creates an instance of an Image-to-3D model pipeline.

public static IXrAImageTo3d LoadImageTo3d(string name, Dictionary<string, string> options = null)

Parameters:

Returns:

Throws:

LoadObjectDetector

Creates an instance of an object detection model pipeline.

public static IXrAiObjectDetector LoadObjectDetector(string name, Dictionary<string, string> options = null, XrAiAssets assets = null)

Parameters:

Returns:

Throws:

LoadImageToText

Creates an instance of an Image-to-Text model pipeline.

public static IXrAiImageToText LoadImageToText(string name, Dictionary<string, string> properties = null)

Parameters:

Returns:

Throws:

LoadImageToImage

Creates an instance of an Image-to-Image model pipeline.

public static IXrAiImageToImage LoadImageToImage(string name, Dictionary<string, string> properties = null)

Parameters:

Returns:

Throws:

LoadTextToImage

Creates an instance of a Text-to-Image model pipeline.

public static IXrAiTextToImage LoadTextToImage(string name, Dictionary<string, string> properties = null)

Parameters:

Returns:

Throws:

LoadSpeechToText

Creates an instance of a Speech-to-Text model pipeline.

public static IXrAiSpeechToText LoadSpeechToText(string name, Dictionary<string, string> properties = null)

Parameters:

Returns:

Throws:

LoadTextToSpeech

Creates an instance of a Text-to-Speech model pipeline.

public static IXrAiTextToSpeech LoadTextToSpeech(string name, Dictionary<string, string> properties = null)

Parameters:

Returns:

Throws:

Usage Example

// Load a Groq Image-to-Text model
IXrAiImageToText imageToText = XrAiFactory.LoadImageToText("Groq", new Dictionary<string, string> 
{
    { "apiKey", "your-api-key" }
});

// Load a YOLO object detector
IXrAiObjectDetector objectDetector = XrAiFactory.LoadObjectDetector("Yolo", null, assets);

Notes