webhook / README.md
spaces-ci-bot's picture
Update README.md
0b66ecf
metadata
title: Spaces Ci Bot
emoji: πŸ‘
colorFrom: yellow
colorTo: red
sdk: gradio
sdk_version: 3.17.0
app_file: app.py
pinned: true

Spaces CI webhook

This is a webhook space to build temporary Spaces when a PR is submitted.

gradio_webhooks

This is also a PoC for a gradio_webhooks helper library. It uses Gradio to launch a server and register webhooks on it.

The major goal is to make the development process as easy as possible:

  • debug your webhooks locally using a Gradio URL
  • push your webhook server to a Gradio Space once ready

Features:

  • Server app with GradioWebhookApp
  • Debug locally before deploying on Spaces
  • Handle x-webhook-secret header
  • Output is parsed as WebhookPayload (to be completed)
  • Landing page to render README (or markdown page)

Quick example:

app.py

from gradio_webhooks import GradioWebhookApp, WebhookPayload

app = GradioWebhookApp(webhook_secret="my_dummy_secret")


@app.add_webhook("/my_webhook")
async def hello(payload: WebhookPayload):
    print(f"Received webhook for repo {payload.repo.name}")
    return {"processed": True}


app.ready()

Output in terminal

Running on local URL:  http://127.0.0.1:7860
Running on public URL: https://18ffc05a-d0bf-4041.gradio.live

This share link expires in 72 hours. For free permanent hosting and GPU upgrades (NEW!), check out Spaces: https://huggingface.co/spaces

Webhook secret is correctly defined.

Webhooks are correctly setup and ready to use:
  - POST https://18ffc05a-d0bf-4041.gradio.live/my_webhook
Go to https://huggingface.co/settings/webhooks to setup your webhooks.