Spaces:
Sleeping
Sleeping
Download src/examples.py from Slep/CondViT-LRVSF-Demo: direct link, hf CLI and curl.
- Browser
- Download file 566 Bytes
-
https://huggingface.co/spaces/Slep/CondViT-LRVSF-Demo/resolve/main/src/examples.py
- Command line
-
hf download hf://spaces/Slep/CondViT-LRVSF-Demo/src/examples.py
-
curl -L -o examples.py https://huggingface.co/spaces/Slep/CondViT-LRVSF-Demo/resolve/main/src/examples.py
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 |