GuglielmoTor commited on
Commit
734a45c
·
verified ·
1 Parent(s): 751e28f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -12,15 +12,21 @@ def receive_token(accessToken: str):
12
  def check_status():
13
  return "✅ Code received" if token_received["status"] else "❌ Code not received"
14
 
 
 
 
 
15
  with gr.Blocks() as demo:
16
  # we don’t actually show these widgets in the UI:
17
  hidden_token = gr.Textbox(visible=False)
18
- hidden_btn = gr.Button(visible=False)
19
  # wire up the hidden POST→function
20
  hidden_btn.click(fn=receive_token, inputs=hidden_token, outputs=[])
21
 
22
  # your visible UI
23
  status_box = gr.Textbox(value=check_status(), label="Token Status", interactive=False)
24
- refresh = gr.Button("Refresh").click(fn=check_status, outputs=status_box)
 
 
25
 
26
- demo.launch(server_name="0.0.0.0", server_port=7860)
 
12
  def check_status():
13
  return "✅ Code received" if token_received["status"] else "❌ Code not received"
14
 
15
+ def reset_status():
16
+ token_received["status"] = False
17
+ return "❌ Code not received"
18
+
19
  with gr.Blocks() as demo:
20
  # we don’t actually show these widgets in the UI:
21
  hidden_token = gr.Textbox(visible=False)
22
+ hidden_btn = gr.Button(visible=False)
23
  # wire up the hidden POST→function
24
  hidden_btn.click(fn=receive_token, inputs=hidden_token, outputs=[])
25
 
26
  # your visible UI
27
  status_box = gr.Textbox(value=check_status(), label="Token Status", interactive=False)
28
+ with gr.Row():
29
+ refresh = gr.Button("Refresh").click(fn=check_status, outputs=status_box)
30
+ reset = gr.Button("Reset Status").click(fn=reset_status, outputs=status_box)
31
 
32
+ demo.launch(server_name="0.0.0.0", server_port=7860)