You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not supported yet, but you can simply add few lines of code and use it.
in DataTypes.cs
publicstructImageData{publicstringUrl{get;set;}publicstringB64Json{get;set;}// add two lines of codes below[JsonProperty(NullValueHandling=NullValueHandling.Ignore)]publicstringrevised_prompt{get;set;}}publicsealedclassCreateImageRequest:CreateImageRequestBase{publicstringPrompt{get;set;}// add this linepublicstringModel{get;set;}}
Usage:
// DALL-E Image gen requestvarresponse=awaitopenai.CreateImage(newCreateImageRequest{Prompt=prompt,Size=ImageSize.Size1024,// Image Size must over 1024Model="dall-e-3"// Dall-E 3 Model});if(response.Data!=null&&response.Data.Count>0){using(varrequest=newUnityWebRequest(response.Data[0].Url)){request.downloadHandler=newDownloadHandlerBuffer();request.SendWebRequest();while(!request.isDone)awaitTask.Yield();if(request.result==UnityWebRequest.Result.ProtocolError||request.result==UnityWebRequest.Result.ConnectionError){Debug.LogError("Error in downloading image: "+request.error);}else{Texture2Dtexture=newTexture2D(2,2);texture.LoadImage(request.downloadHandler.data);varsprite=Sprite.Create(texture,newRect(0,0,1024,1024),Vector2.zero,1f);imageDisplay.sprite=sprite;}}}else{Debug.LogWarning("No image was created from this prompt.");}
Activity
kwan3854 commentedon Nov 30, 2023
Not supported yet, but you can simply add few lines of code and use it.
in DataTypes.cs
Usage: