Download web/template_engine.py from rfannn/test: direct link, hf CLI and curl.
- Browser
- Download file 272 Bytes
-
https://huggingface.co/spaces/rfannn/test/resolve/main/web/template_engine.py
- Command line
-
hf download hf://spaces/rfannn/test/web/template_engine.py
-
curl -L -o template_engine.py https://huggingface.co/spaces/rfannn/test/resolve/main/web/template_engine.py
272 Bytes
| from jinja2 import Environment, FileSystemLoader | |
| from pathlib import Path | |
| _env = Environment(loader=FileSystemLoader(Path(__file__).parent / "templates"), autoescape=True) | |
| def render(name: str, **context): | |
| t = _env.get_template(name) | |
| return t.render(**context) | |