CondViT-LRVSF-Demo / src /examples.py
Slep's picture
Initial Demo.
c45703e
raw
history blame contribute delete
No virus
566 Bytes
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"<figure id='example_{i}' onclick='remap_click({i})'>"
img = Image.open(img_path).convert("RGB")
ret += make_img_html(img)
ret += f"<figcaption>{category}</figcaption>"
ret += "</figure>"
ret += "<p></p>"
return ret