File size: 771 Bytes
24b5bff
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr

# 
demand_data = {"A": 0, "B": 0, "C": 0, "D": 0, "E": 0, "F": 0}

def update_demand(station):
    demand_data[station] += 1
    # 
    output = "--- Real-time Demand Board ---\n"
    for s, count in demand_data.items():
        output += f"Station {s}: {count} passengers waiting\n"
    return output

# 
with gr.Blocks() as demo:
    gr.Markdown("# Transit Intent Dashboard (TID)")
    gr.Markdown("Click a station to signal your intent to board.")
    
    with gr.Row():
        for s in demand_data.keys():
            btn = gr.Button(f"Station {s}")
            btn.click(fn=update_demand, inputs=[gr.State(s)], outputs=[gr.Textbox(label="Status")])
            
    output_box = gr.Textbox(label="Status", value="System Ready")

demo.launch()