Spaces:
Running
Running
Download upload_space.py from KETI-NLP/K-Prism_Benchmark: direct link, hf CLI and curl.
- Browser
- Download file 1.49 kB
-
https://huggingface.co/spaces/KETI-NLP/K-Prism_Benchmark/resolve/main/upload_space.py
- Command line
-
hf download hf://spaces/KETI-NLP/K-Prism_Benchmark/upload_space.py
-
curl -L -o upload_space.py https://huggingface.co/spaces/KETI-NLP/K-Prism_Benchmark/resolve/main/upload_space.py
1.49 kB
| """Upload this static app to an existing Static Space using the saved HF login.""" | |
| import argparse | |
| from pathlib import Path | |
| from huggingface_hub import HfApi | |
| ROOT = Path(__file__).resolve().parent | |
| FILES = [ | |
| '.gitignore', | |
| 'README.md', | |
| 'index.html', | |
| 'config.mjs', | |
| 'data.mjs', | |
| 'leaderboard.mjs', | |
| 'benchmark.json', | |
| 'tests/test_static_space.py', | |
| 'upload_space.py', | |
| ] | |
| def main(): | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument('--repo-id', default='KETI-NLP/K-Prism_Benchmark') | |
| parser.add_argument('--message', default='Update static benchmark leaderboard') | |
| args = parser.parse_args() | |
| for name in FILES: | |
| if not (ROOT / name).is_file(): | |
| parser.error('Missing deployment file: ' + name) | |
| api = HfApi() | |
| space = api.space_info(args.repo_id) | |
| if space.sdk != 'static': | |
| parser.error('Upload target must already be a Static Space: ' + args.repo_id) | |
| # upload_folder writes to the existing repository without create_repo(). | |
| # Older hf upload versions send space_sdk="gradio" in that extra request. | |
| commit = api.upload_folder( | |
| repo_id=args.repo_id, | |
| repo_type='space', | |
| folder_path=ROOT, | |
| allow_patterns=FILES, | |
| parent_commit=space.sha, | |
| commit_message=args.message, | |
| ) | |
| print('Uploaded:', commit.commit_url) | |
| print('Space: https://huggingface.co/spaces/' + args.repo_id) | |
| if __name__ == '__main__': | |
| main() | |