feat: Implement upscale functionality with ONNX models
- Added upscale operator to handle image upscaling by 4x using AI models. - Introduced new jobs for upscale processing in the server, including debug and standard upscale jobs. - Created a new ONNX model handler for upscale operations, supporting tiled inference and resource management. - Updated tests to cover new upscale functionality, including input validation and output verification. - Added documentation for the upscale feature, detailing usage and model options.
This commit is contained in:
@@ -7,8 +7,11 @@ class AnyImageImageMenu(bpy.types.Menu):
|
||||
bl_idname = "ANYIMAGE_MT_image_context"
|
||||
bl_label = "AnyImage"
|
||||
|
||||
def draw(self, _context):
|
||||
from .properties import ai_setup_label, ai_status
|
||||
def draw(self, context):
|
||||
from .properties import (
|
||||
ai_setup_label,
|
||||
ai_status,
|
||||
)
|
||||
|
||||
layout = self.layout
|
||||
layout.operator_context = "INVOKE_DEFAULT"
|
||||
@@ -27,11 +30,17 @@ class AnyImageImageMenu(bpy.types.Menu):
|
||||
text="Convert to Surface…",
|
||||
icon="MESH_GRID",
|
||||
)
|
||||
layout.separator()
|
||||
layout.operator(
|
||||
"anyimage.remove_image_background",
|
||||
text="Remove Background",
|
||||
icon="IMAGE_ALPHA",
|
||||
)
|
||||
layout.operator(
|
||||
"anyimage.upscale_image",
|
||||
text=upscale_menu_label(context),
|
||||
icon="FULLSCREEN_ENTER",
|
||||
)
|
||||
layout.separator()
|
||||
status = ai_status()
|
||||
if status["ready"]:
|
||||
@@ -48,12 +57,24 @@ class AnyImageImageMenu(bpy.types.Menu):
|
||||
)
|
||||
|
||||
|
||||
def upscale_menu_label(context):
|
||||
source_object = getattr(context, "object", None)
|
||||
if not is_image_empty(source_object):
|
||||
return "Upscale"
|
||||
width, height = (
|
||||
int(value) for value in getattr(source_object.data, "size", (0, 0))
|
||||
)
|
||||
if width <= 0 or height <= 0:
|
||||
return "Upscale"
|
||||
return f"Upscale ({width} × {height})"
|
||||
|
||||
|
||||
def draw_image_context_menu(self, context):
|
||||
if not is_image_empty(context.object):
|
||||
return
|
||||
self.layout.separator()
|
||||
self.layout.menu(
|
||||
AnyImageImageMenu.bl_idname,
|
||||
text="AnyImage",
|
||||
icon="PLUGIN",
|
||||
)
|
||||
self.layout.separator()
|
||||
|
||||
Reference in New Issue
Block a user