2023-11-23 17:19:58 +00:00
|
|
|
import unittest
|
|
|
|
|
|
|
|
from onnx_web.chain.result import StageResult
|
|
|
|
from onnx_web.chain.upscale_swinir import UpscaleSwinIRStage
|
|
|
|
from onnx_web.params import HighresParams, UpscaleParams
|
|
|
|
from onnx_web.server.context import ServerContext
|
|
|
|
from onnx_web.worker.context import WorkerContext
|
|
|
|
from tests.helpers import test_device, test_needs_onnx_models
|
|
|
|
|
|
|
|
TEST_MODEL = "../models/upscaling-swinir-real-large-x4"
|
|
|
|
|
|
|
|
|
|
|
|
class UpscaleSwinIRStageTests(unittest.TestCase):
|
|
|
|
@test_needs_onnx_models([TEST_MODEL])
|
|
|
|
def test_empty(self):
|
|
|
|
stage = UpscaleSwinIRStage()
|
|
|
|
sources = StageResult.empty()
|
|
|
|
result = stage.run(
|
|
|
|
WorkerContext(
|
|
|
|
"test",
|
|
|
|
test_device(),
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
None,
|
|
|
|
3,
|
|
|
|
0.1,
|
|
|
|
),
|
2023-11-25 21:28:03 +00:00
|
|
|
ServerContext(),
|
2023-11-23 17:19:58 +00:00
|
|
|
None,
|
|
|
|
None,
|
|
|
|
sources,
|
|
|
|
highres=HighresParams(False, 1, 0, 0),
|
|
|
|
upscale=UpscaleParams(TEST_MODEL),
|
|
|
|
)
|
2024-01-06 02:13:57 +00:00
|
|
|
result.validate()
|
2023-11-23 17:19:58 +00:00
|
|
|
|
|
|
|
self.assertEqual(len(result), 0)
|