Files changed (1) hide show
  1. app.py +0 -41
app.py DELETED
@@ -1,41 +0,0 @@
1
- def run_simulation(num_workers, batch_time, network_latency, mode, num_batches):
2
- """Wrapper for Gradio interface."""
3
- timelines, metrics = simulate_batches(
4
- num_workers=int(num_workers),
5
- batch_time=float(batch_time),
6
- network_latency=float(network_latency),
7
- mode=mode,
8
- num_batches=int(num_batches)
9
- )
10
- fig = plot_timeline(timelines, metrics, num_workers)
11
- return fig, (
12
- f"Mode: {mode.capitalize()}\n"
13
- f"Epoch Time: {metrics['epoch_time_ms']:.2f} ms\n"
14
- f"Idle Time: {metrics['idle_percent']} %\n"
15
- f"Throughput: {metrics['throughput']} batches/sec"
16
- )
17
-
18
- # Define Gradio UI
19
- interface = gr.Interface(
20
- fn=run_simulation,
21
- inputs=[
22
- gr.Slider(1, 8, value=4, step=1, label="Number of Workers"),
23
- gr.Slider(100, 1000, value=500, step=50, label="Batch Processing Time (ms)"),
24
- gr.Slider(50, 500, value=200, step=25, label="Network Latency (ms)"),
25
- gr.Radio(["synchronous", "asynchronous"], value="synchronous", label="Mode"),
26
- gr.Slider(5, 30, value=10, step=1, label="Number of Batches per Epoch"),
27
- ],
28
- outputs=[
29
- gr.Plot(label="Timeline Visualization"),
30
- gr.Textbox(label="Simulation Summary", lines=6, max_lines=8, show_copy_button=True)
31
- ],
32
- title="🧠 Batch Scheduler Simulator",
33
- description="Visualize how synchronous vs. asynchronous batch scheduling affects throughput, idle time, and epoch duration.",
34
- examples=[
35
- [4, 500, 200, "synchronous", 10],
36
- [8, 400, 150, "asynchronous", 15]
37
- ]
38
- )
39
-
40
- # Launch interface
41
- interface.launch(share=True)