from PIL import Image from .process_images import make_img_html class ExamplesHandler: def __init__(self, examples): self.examples = examples def to_html(self): ret = "" for i, (img_path, category) in enumerate(self.examples): ret += f"
" img = Image.open(img_path).convert("RGB") ret += make_img_html(img) ret += f"
{category}
" ret += "
" ret += "

" return ret