Spaces:
Sleeping
Sleeping
Download app.py from besti11/Transit-Internet-Simulation: direct link, hf CLI and curl.
- Browser
- Download file 771 Bytes
-
https://huggingface.co/spaces/besti11/Transit-Internet-Simulation/resolve/main/app.py
- Command line
-
hf download hf://spaces/besti11/Transit-Internet-Simulation/app.py
-
curl -L -o app.py https://huggingface.co/spaces/besti11/Transit-Internet-Simulation/resolve/main/app.py
771 Bytes
| 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() | |