Spaces:
Runtime error
Runtime error
| """ | |
| Gradio Space CI is a plugin (and package) to create ephemeral Spaces for each PR opened on your Space repo. | |
| The goal is to foster community contributions by making the review process as lean as possible. | |
| # Key features: | |
| 1. Listen to Pull Requests. | |
| 2. Launch ephemeral Spaces on new PRs. | |
| 1. When a commit is pushed to a PR, the ephemeral Space gets synchronized. | |
| 2. When the PR is closed, the ephemeral Space is deleted. | |
| 3. Configure ephemeral Spaces automatically | |
| 1. All variables are copied from the main Space. | |
| 2. Secrets are copied from the main Space, based on CI configuration. | |
| 3. Hardware and storage are set, based on CI configuration. | |
| 4. Only trusted authors are able to access secrets | |
| 1. By default, repo owners are trusted authors | |
| 2. More authors can be added in CI configuration | |
| 3. untrusted authors can start ephemeral Space but without secrets or custom hardware | |
| # Useful links: | |
| - Demo: https://huggingface.co/spaces/Wauplin/gradio-space-ci | |
| - README: https://huggingface.co/spaces/Wauplin/gradio-space-ci/blob/main/README.md | |
| - Questions and feedback: https://huggingface.co/spaces/Wauplin/gradio-space-ci/discussions | |
| - Release notes: https://huggingface.co/spaces/Wauplin/gradio-space-ci/blob/main/RELEASE.md | |
| """ | |
| import warnings | |
| from huggingface_hub import get_token | |
| # Check if `HF_TOKEN` is set. If not, Space CI will be disabled but no error is raised. | |
| if get_token() is None: | |
| warnings.warn( | |
| "Cannot find `HF_TOKEN` in environment variables. Please set a token in your Space secrets to enable ephemeral Spaces." | |
| ) | |
| def enable_space_ci() -> None: | |
| return | |
| else: | |
| from .webhook import enable_space_ci # noqa: F401 | |
| __version__ = "0.2.3" | |