docs.unity3d.com
    Show / Hide Table of Contents

    Class GenerativeAIBackend

    Inheritance
    Object
    GenerativeAIBackend
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.Muse.Common
    Syntax
    public class GenerativeAIBackend

    Fields

    k_ServiceBaseURL

    Declaration
    protected const string k_ServiceBaseURL = "https://musetools-stg-hbasf8cec2dxb0dh.z01.azurefd.net/api/v1"
    Field Value
    Type Description
    String

    k_TextToImageServiceBaseURL

    Declaration
    protected static readonly string k_TextToImageServiceBaseURL
    Field Value
    Type Description
    String

    Properties

    AccessToken

    Declaration
    protected static string AccessToken { get; }
    Property Value
    Type Description
    String

    Methods

    DownloadArtifact<TArtifactType>(Artifact<TArtifactType>, Action<Object, String>)

    Download texture image from the Cloud

    Declaration
    public static UnityWebRequestAsyncOperation DownloadArtifact<TArtifactType>(Artifact<TArtifactType> artifact, Action<object, string> onDone)
    Parameters
    Type Name Description
    Artifact<TArtifactType> artifact

    The typed artifact identifier to request

    Action<Object, String> onDone

    Callback called when results are received. Callback parameters (Texture2D, byte[], string) represent received Texture2D object, it's original byte stream as PNG file and error string. In case error occured error string is non-null and other parameters are null

    Returns
    Type Description
    UnityWebRequestAsyncOperation

    The the reference to the async operation this generates so that it may be cancelled

    Type Parameters
    Name Description
    TArtifactType

    GenerateInpainting(String, String, Texture2D, MaskType, TextToImageRequest, Action<TextToImageResponse, String>)

    Declaration
    public static UnityWebRequestAsyncOperation GenerateInpainting(string prompt, string sourceGuid, Texture2D mask, MaskType maskType, TextToImageRequest settings, Action<TextToImageResponse, string> onDone)
    Parameters
    Type Name Description
    String prompt
    String sourceGuid
    Texture2D mask
    MaskType maskType
    TextToImageRequest settings
    Action<TextToImageResponse, String> onDone
    Returns
    Type Description
    UnityWebRequestAsyncOperation

    GetArtifactStatus<TArtifactType>(Artifact<TArtifactType>, GenerativeAIBackend.ArtifactProgressCallback, Boolean)

    Starts polling for the status of artifact generation. Will return the status through the supplied callback. This is not cancellable as many chained web requests can be generated by polling until copleted. TODO: Don't do that.

    Declaration
    public static void GetArtifactStatus<TArtifactType>(Artifact<TArtifactType> artifact, GenerativeAIBackend.ArtifactProgressCallback onStatusReceived, bool pollUntilCompletedOrFailed = true)
    Parameters
    Type Name Description
    Artifact<TArtifactType> artifact

    The artifact you wish to query the status of

    GenerativeAIBackend.ArtifactProgressCallback onStatusReceived

    The callback to receive the update from. This is guaranteed to run on the Unity main thread. Cannot be null

    Boolean pollUntilCompletedOrFailed
    Type Parameters
    Name Description
    TArtifactType

    The concrete artifact Unity type you are polling for

    RequestStyleTrain(String, String, String[], Action<StyleTrainResponse, String>)

    Train a style using a set of textures

    Declaration
    public static void RequestStyleTrain(string guid, string name, string[] texturesData, Action<StyleTrainResponse, string> onDone)
    Parameters
    Type Name Description
    String guid
    String name
    String[] texturesData
    Action<StyleTrainResponse, String> onDone

    RequestStyleTrainStatus(String, Action<StyleTrainStatusResponse, String>)

    Declaration
    public static void RequestStyleTrainStatus(string guid, Action<StyleTrainStatusResponse, string> onDone)
    Parameters
    Type Name Description
    String guid
    Action<StyleTrainStatusResponse, String> onDone

    SendJSONRequest(String, Object, Action<Object, String>)

    Declaration
    protected static UnityWebRequestAsyncOperation SendJSONRequest(string serviceURL, object requestBody, Action<object, string> onDone)
    Parameters
    Type Name Description
    String serviceURL
    Object requestBody
    Action<Object, String> onDone
    Returns
    Type Description
    UnityWebRequestAsyncOperation

    SendRequest(UnityWebRequest, Action<Object, String>)

    Declaration
    protected static UnityWebRequestAsyncOperation SendRequest(UnityWebRequest request, Action<object, string> onDone)
    Parameters
    Type Name Description
    UnityWebRequest request
    Action<Object, String> onDone
    Returns
    Type Description
    UnityWebRequestAsyncOperation

    VariateImage(String, String, TextToImageRequest, Action<TextToImageResponse, String>)

    Initiate Image variation generation on Cloud. It only allocates texture ids and actual generation occurs in background. Use RequestStatus to query progress and DownloadImage to download intermediate or final result.

    Declaration
    public static UnityWebRequestAsyncOperation VariateImage(string sourceGuid, string prompt, TextToImageRequest settings, Action<TextToImageResponse, string> onDone)
    Parameters
    Type Name Description
    String sourceGuid
    String prompt
    TextToImageRequest settings
    Action<TextToImageResponse, String> onDone
    Returns
    Type Description
    UnityWebRequestAsyncOperation
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023