Image Upscale

Image Upscale UI

AI Server's Image Upscale UI lets you use AI to 2x upscale and image from its active Comfy UI Agents:

https://localhost:5006/ImageUpscale

Using Image Upscale Endpoints

These endpoints are used in a similar way to other AI Server endpoints where you can provide:

  • RefId - provide a unique identifier to track requests
  • Tag - categorize like requests under a common group

In addition Queue requests can provide:

  • ReplyTo - URL to send a POST request to when the request is complete

Image Upscale

using var fsImage = File.OpenRead("files/test_image.jpg");
var response = client.PostFileWithRequest(new ImageUpscale(),
    new UploadFile("image", fsImage, "image"));

File.WriteAllBytes(saveToPath, response.Results[0].Url.GetBytesFromUrl());

Queue Image Upscale

using var fsImage = File.OpenRead("files/test_image.jpg");
var response = client.PostFileWithRequest(new QueueImageUpscale(),
    new UploadFile("image", fsImage, "image"));

// Poll for Job Completion Status
GetArtifactGenerationStatusResponse status = new();
while (status.JobState is BackgroundJobState.Queued or BackgroundJobState.Started)
{
    status = client.Get(new GetArtifactGenerationStatus { JobId = response.JobId });
    Thread.Sleep(1000);
}
if (status.Results?.Count > 0)
{
    File.WriteAllBytes(saveToPath, status.Results[0].Url.GetBytesFromUrl());
}

Additional Functionality

AI Server also provides Image-To-Text generation using the ComfyUI Agent that utilizes the Florence 2 model. The ComfyUI Agent must have this model downloaded and installed to support this functionality.