Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -22,19 +22,17 @@ def reset_status():
|
|
22 |
return "❌ Code not received", ""
|
23 |
|
24 |
with gr.Blocks() as demo:
|
25 |
-
# we don’t actually show these widgets in the UI:
|
26 |
hidden_token = gr.Textbox(visible=False)
|
27 |
hidden_btn = gr.Button(visible=False)
|
28 |
-
# wire up the hidden POST→function
|
29 |
hidden_btn.click(fn=receive_token, inputs=hidden_token, outputs=[])
|
30 |
|
31 |
-
# your visible UI
|
32 |
status_box = gr.Textbox(value=check_status(), label="Token Status", interactive=False)
|
33 |
token_display = gr.Textbox(value=show_token(), label="Received Token", interactive=False)
|
|
|
34 |
with gr.Row():
|
35 |
refresh = gr.Button("Refresh").click(fn=check_status, outputs=status_box)
|
36 |
reset = gr.Button("Reset Status").click(fn=reset_status, outputs=[status_box, token_display])
|
37 |
|
38 |
-
|
39 |
|
40 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
22 |
return "❌ Code not received", ""
|
23 |
|
24 |
with gr.Blocks() as demo:
|
|
|
25 |
hidden_token = gr.Textbox(visible=False)
|
26 |
hidden_btn = gr.Button(visible=False)
|
|
|
27 |
hidden_btn.click(fn=receive_token, inputs=hidden_token, outputs=[])
|
28 |
|
|
|
29 |
status_box = gr.Textbox(value=check_status(), label="Token Status", interactive=False)
|
30 |
token_display = gr.Textbox(value=show_token(), label="Received Token", interactive=False)
|
31 |
+
|
32 |
with gr.Row():
|
33 |
refresh = gr.Button("Refresh").click(fn=check_status, outputs=status_box)
|
34 |
reset = gr.Button("Reset Status").click(fn=reset_status, outputs=[status_box, token_display])
|
35 |
|
36 |
+
gr.Timer(1.0, fn=show_token, outputs=token_display) # ← replace .load with this
|
37 |
|
38 |
demo.launch(server_name="0.0.0.0", server_port=7860)
|