Spaces:
Running
Running
""" | |
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 | |
""" | |
import warnings | |
from huggingface_hub import HfFolder | |
# Check if `HF_TOKEN` is set. If not, Space CI will be disabled but no error is raised. | |
if HfFolder.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 configure_space_ci(blocks, *args, kwargs): | |
return blocks | |
else: | |
from .webhook import configure_space_ci # noqa: F401 | |
__version__ = "0.1.0" | |