simonl0909's picture
shared webhook data
8604a93
raw
history blame
583 Bytes
import gradio as gr
from huggingface_hub import WebhooksServer, WebhookPayload
from model import model
webhook_payload = None
with gr.Blocks() as ui:
gr.Markdown(f"## Hugging Face Webhooks Demo\n\n{webhook_payload.json()}")
progress = gr.Progress(track_tqdm=True)
# 2. Create WebhooksServer with custom UI and secret
app = WebhooksServer(ui=ui, webhook_secret="test")
@app.add_webhook
async def train(payload: WebhookPayload):
webhook_payload = payload
print("Received payload:", payload.dict())
return payload.dict()
# 5. Start server (optional)
app.run()