simonl0909 commited on
Commit
85cff44
·
1 Parent(s): 409f9e1

see if this works

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -1,16 +1,20 @@
1
  import gradio as gr
2
  from huggingface_hub import WebhooksServer, WebhookPayload
3
 
4
- from model import model
5
 
6
  webhook_payload = None
7
 
8
  with gr.Blocks() as ui:
9
- gr.Markdown(f"## Hugging Face Webhooks Demo\n\n{webhook_payload.json() if webhook_payload is not None else ''}")
 
 
 
10
  progress = gr.Progress(track_tqdm=True)
 
11
 
12
  # 2. Create WebhooksServer with custom UI and secret
13
- app = WebhooksServer(ui=ui, webhook_secret="test")
14
 
15
  @app.add_webhook
16
  async def train(payload: WebhookPayload):
 
1
  import gradio as gr
2
  from huggingface_hub import WebhooksServer, WebhookPayload
3
 
4
+ # from model import model
5
 
6
  webhook_payload = None
7
 
8
  with gr.Blocks() as ui:
9
+ p = gr.State(None)
10
+ def update_payload():
11
+ return webhook_payload.json() if webhook_payload is not None else ''
12
+ gr.Markdown(f"## Hugging Face Webhooks Demo\n\n{p}")
13
  progress = gr.Progress(track_tqdm=True)
14
+ ui.load(update_payload, outputs=[p])
15
 
16
  # 2. Create WebhooksServer with custom UI and secret
17
+ app = WebhooksServer(ui=ui.load(), webhook_secret="test")
18
 
19
  @app.add_webhook
20
  async def train(payload: WebhookPayload):