Download demo_code_plugin/plugin.py from AccelerationConsortium/IvoryOS: direct link, hf CLI and curl.
- Browser
- Download file 628 Bytes
-
https://huggingface.co/spaces/AccelerationConsortium/IvoryOS/resolve/8d0998ed31928c1948cd03200eec111cf0180742/demo_code_plugin/plugin.py
- Command line
-
hf download hf://spaces/AccelerationConsortium/IvoryOS@8d0998ed31928c1948cd03200eec111cf0180742/demo_code_plugin/plugin.py
-
curl -L -o plugin.py https://huggingface.co/spaces/AccelerationConsortium/IvoryOS/resolve/8d0998ed31928c1948cd03200eec111cf0180742/demo_code_plugin/plugin.py
628 Bytes
| import ivoryos | |
| from flask import render_template, Blueprint, current_app | |
| import os | |
| source_code = Blueprint("source_code", __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) | |