Download demo_code_plugin/plugin.py from AccelerationConsortium/IvoryOS: direct link, hf CLI and curl.
- Browser
- Download file 617 Bytes
-
https://huggingface.co/spaces/AccelerationConsortium/IvoryOS/resolve/main/demo_code_plugin/plugin.py
- Command line
-
hf download hf://spaces/AccelerationConsortium/IvoryOS/demo_code_plugin/plugin.py
-
curl -L -o plugin.py https://huggingface.co/spaces/AccelerationConsortium/IvoryOS/resolve/main/demo_code_plugin/plugin.py
617 Bytes
| from flask import render_template, Blueprint, current_app | |
| import os | |
| source_code = Blueprint("About this demo", __name__, template_folder=os.path.join(os.path.dirname(__file__), "templates")) | |
| # # [main route] the route url can be anything, but "main" is needed as entry point | |
| def main(): | |
| base_exists = "base.html" in current_app.jinja_loader.list_templates() | |
| filepath = os.path.join(os.path.dirname(__file__), 'demo_code.py') | |
| with open(filepath, 'r', encoding='utf-8') as f: | |
| code = f.read() | |
| return render_template('example.html', base_exists=base_exists, code=code) | |