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:
2026-08-23 20:34:35 +08:00
parent 1613bd3194
commit 0cf04a13c6
66 changed files with 2156 additions and 1088 deletions

View File

@@ -25,7 +25,7 @@ class PackTest(unittest.TestCase):
pack = load_pack()
with tempfile.TemporaryDirectory() as directory:
directory_path = Path(directory)
wheel_path = directory_path / "blendjob-0.1.13-py3-none-any.whl"
wheel_path = directory_path / "blendjob-0.1.14-py3-none-any.whl"
wheel_path.write_bytes(b"wheel")
original_dist = pack.DIST_DIR
pack.DIST_DIR = directory_path / "dist"
@@ -95,21 +95,21 @@ class PackTest(unittest.TestCase):
self.assertIn("server/jobs/debug_da3.py", names)
self.assertIn("server/jobs/debug_moge2.py", names)
self.assertIn("server/jobs/debug_ben2.py", names)
self.assertIn("server/jobs/debug_realesrgan.py", names)
self.assertIn("server/jobs/debug_upscale.py", names)
self.assertNotIn("server/processing.py", names)
self.assertNotIn("server/progress.py", names)
self.assertIn("model_catalog.py", names)
self.assertIn("server/model_catalog.py", names)
self.assertIn("server/model_download.py", names)
self.assertIn("server/models/onnx_ben2.py", names)
self.assertIn("server/models/onnx_da3.py", names)
self.assertIn("server/models/onnx_moge2.py", names)
self.assertIn("server/models/onnx_realesrgan.py", names)
self.assertIn("server/models/realesrgan.py", names)
self.assertIn("server/models/onnx_upscale.py", names)
self.assertIn("server/models/upscale.py", names)
self.assertNotIn("server/da3.py", names)
self.assertNotIn("server/moge2.py", names)
self.assertIn("server/__init__.py", names)
self.assertIn(
"wheels/blendjob-0.1.13-py3-none-any.whl",
"wheels/blendjob-0.1.14-py3-none-any.whl",
names,
)
self.assertFalse(
@@ -134,7 +134,7 @@ class PackTest(unittest.TestCase):
def test_reads_extension_dependencies_from_pyproject(self):
pack = load_pack()
self.assertEqual(pack.project_dependencies(), ["blendjob==0.1.13"])
self.assertEqual(pack.project_dependencies(), ["blendjob==0.1.14"])
def test_downloads_declared_wheels_for_target_platform(self):
pack = load_pack()
@@ -143,7 +143,7 @@ class PackTest(unittest.TestCase):
def fake_run(command, check):
self.assertTrue(check)
(destination / "blendjob-0.1.13-py3-none-any.whl").write_bytes(
(destination / "blendjob-0.1.14-py3-none-any.whl").write_bytes(
b"wheel"
)
@@ -151,12 +151,14 @@ class PackTest(unittest.TestCase):
wheels = pack.download_wheels("linux-x64", destination)
command = run.call_args.args[0]
self.assertIn("blendjob==0.1.13", command)
self.assertIn("blendjob==0.1.14", command)
self.assertIn("--find-links", command)
self.assertIn(str(pack.SOURCE_DIR / "wheels"), command)
self.assertIn("--python-version=3.11", command)
self.assertIn("--platform=manylinux2014_x86_64", command)
self.assertEqual(
[wheel.name for wheel in wheels],
["blendjob-0.1.13-py3-none-any.whl"],
["blendjob-0.1.14-py3-none-any.whl"],
)
def test_rejects_unknown_platform(self):
pack = load_pack()