Class GenerativeAIBackend
Inheritance
GenerativeAIBackend
Syntax
public class GenerativeAIBackend
Fields
k_ServiceBaseURL
Declaration
protected const string k_ServiceBaseURL = "https://musetools-stg-hbasf8cec2dxb0dh.z01.azurefd.net/api/v1"
Field Value
k_TextToImageServiceBaseURL
Declaration
protected static readonly string k_TextToImageServiceBaseURL
Field Value
Properties
AccessToken
Declaration
protected static string AccessToken { get; }
Property Value
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 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
Returns
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
RequestStyleTrainStatus(String, Action<StyleTrainStatusResponse, String>)
Declaration
public static void RequestStyleTrainStatus(string guid, Action<StyleTrainStatusResponse, string> onDone)
Parameters
SendJSONRequest(String, Object, Action<Object, String>)
Declaration
protected static UnityWebRequestAsyncOperation SendJSONRequest(string serviceURL, object requestBody, Action<object, string> onDone)
Parameters
Returns
SendRequest(UnityWebRequest, Action<Object, String>)
Declaration
protected static UnityWebRequestAsyncOperation SendRequest(UnityWebRequest request, Action<object, string> onDone)
Parameters
Returns
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
Returns