Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adding scheduler reception and displaying #153

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package/Editor/Images/ImageDataClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Parameters
public int width { get; set; }
public bool hideResults { get; set; }
public string type { get; set; }
public string scheduler { get; set; }
public string prompt { get; set; }
public string negativePrompt { get; set; }
public int height { get; set; }
Expand Down
14 changes: 9 additions & 5 deletions package/Editor/Images/Images.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ public class Images : EditorWindow
[MenuItem("Window/Scenario/Images")]
public static void ShowWindow()
{
if (!isVisible)
if (isVisible)
{
lastPageToken = string.Empty;
imageDataList.Clear();
return;
}
lastPageToken = string.Empty;
imageDataList.Clear();
GetInferencesData();

var images = (Images)GetWindow(typeof(Images));
Expand All @@ -41,7 +42,10 @@ private void OnGUI()

private void OnEnable()
{
ShowWindow();
lastPageToken = string.Empty;
imageDataList.Clear();
GetInferencesData();
ImagesUI.Init();
}

private void OnDestroy()
Expand Down Expand Up @@ -93,7 +97,7 @@ public static void GetInferencesData(Action callback_OnDataGet = null) //why get
Steps = inference.parameters.numInferenceSteps,
Size = new Vector2(inference.parameters.width,inference.parameters.height),
Guidance = inference.parameters.guidance,
Scheduler = "Default", //TODO : change this to reflect the scheduler used for creating this image
Scheduler = inference.parameters.scheduler,
Seed = image.seed,
CreatedAt = inference.createdAt,
modelId = inference.modelId
Expand Down
17 changes: 16 additions & 1 deletion package/Editor/Images/ImagesUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ public void Init(Images _images)
InitializeButtons();
}

/// <summary>
/// Re initialize the Image UI when it's already existing.
/// </summary>
public void Init()
{
InitializeButtons();
}

#endregion


Expand Down Expand Up @@ -339,7 +347,14 @@ private void DrawImageData()
GUILayout.BeginHorizontal();
{
CustomStyle.Label($"Guidance: {currentImageData.Guidance}");
CustomStyle.Label($"Scheduler: {currentImageData.Scheduler}");
if (string.IsNullOrEmpty(currentImageData.Scheduler))
{
CustomStyle.Label($"Scheduler: Default");
}
else
{
CustomStyle.Label($"Scheduler: {currentImageData.Scheduler}");
}
}
GUILayout.EndHorizontal();
CustomStyle.Space(padding);
Expand Down
12 changes: 11 additions & 1 deletion package/Editor/_Services/DataCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ public void ClearAllImageData()
return imageDataList.GetRange(firstIndex, count);
}

public void FillReservedSpaceForImageData(string inferenceId, string id, string url, DateTime createdAt, string _seed)
/// <summary>
/// After inference ending, get image generated and fill the space reserved to it.
/// </summary>
/// <param name="inferenceId"> Id of the Inference </param>
/// <param name="id"> Image Id </param>
/// <param name="url"> URL Image </param>
/// <param name="createdAt"> Date of creation </param>
/// <param name="_scheduler"> Scheduler of the generation</param>
/// <param name="_seed"> Seed of the generation </param>
public void FillReservedSpaceForImageData(string inferenceId, string id, string url, DateTime createdAt, string _scheduler, string _seed)
{
var itm = imageDataList.FirstOrDefault(x =>
{
Expand All @@ -78,6 +87,7 @@ public void FillReservedSpaceForImageData(string inferenceId, string id, string
itm.Id = id;
itm.Url = url;
itm.CreatedAt = createdAt;
itm.Scheduler = _scheduler;
itm.Seed = _seed;
CommonUtils.FetchTextureFromURL(itm.Url, texture =>
{
Expand Down
2 changes: 2 additions & 0 deletions package/Editor/_Services/PromptFetcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ private static async void GetInferenceStatus(string inferenceId, string modelId)
img.Id,
img.Url,
inferenceStatusRoot.inference.createdAt,
inferenceStatusRoot.inference.parameters.scheduler,
img.Seed);
}

Expand Down Expand Up @@ -137,6 +138,7 @@ public class Parameters
public int width { get; set; }
public int height { get; set; }
public string type { get; set; }
public string scheduler { get; set; }
public string image { get; set; }
public string prompt { get; set; }
public string mask { get; set; }
Expand Down
Loading