lint fixes
This commit is contained in:
parent
c5d64e7b1e
commit
26c1631709
|
@ -217,24 +217,31 @@ class ImageMetadata:
|
|||
|
||||
if self.inversions is not None:
|
||||
for name, weight in self.inversions:
|
||||
hash = self.get_network_hash(server, name, "inversion")[1]
|
||||
model_hash = self.get_network_hash(server, name, "inversion")[1]
|
||||
json["inversions"].append(
|
||||
{"name": name, "weight": weight, "hash": hash}
|
||||
{"name": name, "weight": weight, "hash": model_hash}
|
||||
)
|
||||
|
||||
if self.loras is not None:
|
||||
for name, weight in self.loras:
|
||||
hash = self.get_network_hash(server, name, "lora")[1]
|
||||
json["loras"].append({"name": name, "weight": weight, "hash": hash})
|
||||
model_hash = self.get_network_hash(server, name, "lora")[1]
|
||||
json["loras"].append(
|
||||
{"name": name, "weight": weight, "hash": model_hash}
|
||||
)
|
||||
|
||||
if self.models is not None:
|
||||
for name, weight in self.models:
|
||||
name, hash = self.get_model_hash(server)
|
||||
json["models"].append({"name": name, "weight": weight, "hash": hash})
|
||||
name, model_hash = self.get_model_hash(server)
|
||||
json["models"].append(
|
||||
{"name": name, "weight": weight, "hash": model_hash}
|
||||
)
|
||||
|
||||
return json
|
||||
|
||||
|
||||
ERROR_NO_METADATA = "metadata must be provided"
|
||||
|
||||
|
||||
class StageResult:
|
||||
"""
|
||||
Chain pipeline stage result.
|
||||
|
@ -318,7 +325,7 @@ class StageResult:
|
|||
if metadata is not None:
|
||||
self.metadata.append(metadata)
|
||||
else:
|
||||
raise ValueError("metadata must be provided")
|
||||
raise ValueError(ERROR_NO_METADATA)
|
||||
|
||||
def push_image(self, image: Image.Image, metadata: ImageMetadata):
|
||||
if self.images is not None:
|
||||
|
@ -331,7 +338,7 @@ class StageResult:
|
|||
if metadata is not None:
|
||||
self.metadata.append(metadata)
|
||||
else:
|
||||
raise ValueError("metadata must be provided")
|
||||
raise ValueError(ERROR_NO_METADATA)
|
||||
|
||||
def insert_array(self, index: int, array: np.ndarray, metadata: ImageMetadata):
|
||||
if self.arrays is not None:
|
||||
|
@ -346,7 +353,7 @@ class StageResult:
|
|||
if metadata is not None:
|
||||
self.metadata.insert(index, metadata)
|
||||
else:
|
||||
raise ValueError("metadata must be provided")
|
||||
raise ValueError(ERROR_NO_METADATA)
|
||||
|
||||
def insert_image(self, index: int, image: Image.Image, metadata: ImageMetadata):
|
||||
if self.images is not None:
|
||||
|
@ -359,7 +366,7 @@ class StageResult:
|
|||
if metadata is not None:
|
||||
self.metadata.insert(index, metadata)
|
||||
else:
|
||||
raise ValueError("metadata must be provided")
|
||||
raise ValueError(ERROR_NO_METADATA)
|
||||
|
||||
def size(self) -> Size:
|
||||
if self.images is not None:
|
||||
|
|
|
@ -161,7 +161,6 @@ def image_reply(
|
|||
|
||||
|
||||
def multi_image_reply(results: Dict[str, Any]):
|
||||
# TODO: not that
|
||||
return jsonify(
|
||||
{
|
||||
"results": results,
|
||||
|
@ -654,7 +653,7 @@ def job_cancel(server: ServerContext, pool: DevicePoolExecutor):
|
|||
if len(job_list) == 0:
|
||||
return error_reply("at least one job name is required")
|
||||
|
||||
results = []
|
||||
results: List[Dict[str, str]] = []
|
||||
for job_name in job_list:
|
||||
job_name = sanitize_name(job_name)
|
||||
cancelled = pool.cancel(job_name)
|
||||
|
|
|
@ -452,10 +452,10 @@ class BuildCachePathsTests(unittest.TestCase):
|
|||
name = "model"
|
||||
client = "client2"
|
||||
cache = "/path/to/cache"
|
||||
format = "onnx"
|
||||
model_format = "onnx"
|
||||
|
||||
conversion = ConversionContext(cache_path=cache)
|
||||
result = build_cache_paths(conversion, name, client, cache, format)
|
||||
result = build_cache_paths(conversion, name, client, cache, model_format)
|
||||
|
||||
expected_paths = [
|
||||
path.join("/path/to/cache", ONNX_MODEL),
|
||||
|
@ -466,10 +466,10 @@ class BuildCachePathsTests(unittest.TestCase):
|
|||
def test_build_cache_paths_with_existing_extension(self):
|
||||
client = "client3"
|
||||
cache = "/path/to/cache"
|
||||
format = "onnx"
|
||||
model_format = "onnx"
|
||||
|
||||
conversion = ConversionContext(cache_path=cache)
|
||||
result = build_cache_paths(conversion, TORCH_MODEL, client, cache, format)
|
||||
result = build_cache_paths(conversion, TORCH_MODEL, client, cache, model_format)
|
||||
|
||||
expected_paths = [
|
||||
path.join("/path/to/cache", TORCH_MODEL),
|
||||
|
@ -481,10 +481,10 @@ class BuildCachePathsTests(unittest.TestCase):
|
|||
name = "model"
|
||||
client = "client4"
|
||||
cache = "/path/to/cache"
|
||||
format = "onnx"
|
||||
model_format = "onnx"
|
||||
|
||||
conversion = ConversionContext(cache_path=cache)
|
||||
result = build_cache_paths(conversion, name, client, cache, format)
|
||||
result = build_cache_paths(conversion, name, client, cache, model_format)
|
||||
|
||||
expected_paths = [
|
||||
path.join("/path/to/cache", ONNX_MODEL),
|
||||
|
|
|
@ -6,7 +6,7 @@ from onnx_web.image.laion_face import draw_pupils, generate_annotation, reverse_
|
|||
|
||||
|
||||
class TestLaionFace(unittest.TestCase):
|
||||
@unittest.skip
|
||||
@unittest.skip("need to prepare a good input image")
|
||||
def test_draw_pupils(self):
|
||||
# Create a dummy image
|
||||
image = np.zeros((100, 100, 3), dtype=np.uint8)
|
||||
|
@ -34,7 +34,7 @@ class TestLaionFace(unittest.TestCase):
|
|||
|
||||
self.assertNotEqual(np.sum(image), 0, "Image should be modified")
|
||||
|
||||
@unittest.skip
|
||||
@unittest.skip("need to prepare a good input image")
|
||||
def test_generate_annotation(self):
|
||||
# Create a dummy image
|
||||
image = np.zeros((100, 100, 3), dtype=np.uint8)
|
||||
|
|
Loading…
Reference in New Issue