Spaces:
Sleeping
Sleeping
| 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() | |