webhook / ui.py
testbot
Use huggingface_hub.WebhooksServer
a5e8053
import gradio as gr
TITLE = "βš™οΈ Spaces CI Bot βš™οΈ"
DESCRIPTION = """
Welcome to the Spaces CI Bot!
You are a few clicks away from having the CI Bot configured on your Spaces. No code or maintenance is required: simply configure a webhook and you're done! πŸš€
## Things to know
- You can enable the CI Bot for a single Space or globally for all Spaces of a user/organization. You do not need to own the Space to enable the CI Bot on it.
- When a PR is opened on a watched Space, an ephemeral Space is deployed with the changes.
- Any changes pushed to a PR will trigger a re-deployment. Once the PR is merged, the ephemeral Space is deleted.
- If your Space requires configuration (secrets or upgraded hardware), you must duplicate the ephemeral Space to your account and configure the settings by yourself. You are responsible of making sure that the changes introduced in the PR are not harmful (leak secrets, run malicious scripts,...).
- The Bot is still in beta. Feel free to give us feedback in the [Community tab](https://huggingface.co/datasets/spaces-ci-bot/webhook/discussions).
## Instructions
#### 1. Go to your [settings page](https://huggingface.co/settings/webhooks) > "Add a new webhook"
#### 2. Configure your webhook (see image below)
1. Filter which user, organization or Space you want to watch. It can be a Space you own or not. In this example, all Spaces from `Wauplin` are watched.
2. Set the webhook URL to <https://spaces-ci-bot-webhook.hf.space/webhooks/trigger_ci_on_pr>.
3. Make sure to watch both "repo changes" and "community"
![](https://huggingface.co/spaces/spaces-ci-bot/webhook/resolve/main/configure_webhook.jpg)
#### 3. "Create webhook" > You are done!
Existing PRs will get an ephemeral Space as soon as you push at least one commit to the repository.
"""
def generate_ui() -> gr.Blocks:
ui = gr.Blocks()
with ui:
gr.Markdown(f"<h1 style='text-align: center; margin-bottom: 1rem'>{TITLE}</h1>")
gr.Markdown(DESCRIPTION)
return ui