Spaces:
Runtime error
Runtime error
File size: 583 Bytes
5e82ff3 6f6920c 5e82ff3 6f6920c 5e82ff3 8604a93 6f6920c 8604a93 6f6920c 06df53b 6f6920c 06df53b 6f6920c 8604a93 6f6920c 06df53b 6f6920c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|