Commit c2487d92 authored by narugo1992's avatar narugo1992
Browse files

dev(narugo): regenerate doc

parent a7ea6054
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
import os
import random

from huggingface_hub import HfFileSystem

from benchmark import BaseBenchmark, create_plot_cli
from imgutils.generic.classify import _open_models_for_repo_id
from imgutils.validate import anime_real
from imgutils.validate.real import _REPO_ID

hf_fs = HfFileSystem()

_REPOSITORY = 'deepghs/anime_real_cls'
_MODEL_NAMES = [
    os.path.relpath(file, _REPOSITORY).split('/')[0] for file in
    hf_fs.glob(f'{_REPOSITORY}/*/model.onnx')
]
_MODEL_NAMES = _open_models_for_repo_id(_REPO_ID).model_names


class AnimeRealBenchmark(BaseBenchmark):
@@ -21,12 +14,10 @@ class AnimeRealBenchmark(BaseBenchmark):
        self.model = model

    def load(self):
        from imgutils.validate.real import _open_anime_real_model
        _ = _open_anime_real_model(self.model)
        _open_models_for_repo_id(_REPO_ID)._open_model(self.model)

    def unload(self):
        from imgutils.validate.real import _open_anime_real_model
        _open_anime_real_model.cache_clear()
        _open_models_for_repo_id(_REPO_ID).clear()

    def run(self):
        image_file = random.choice(self.all_images)
+0 −2296

File deleted.

Preview size limit exceeded, changes collapsed.