gille1983 commited on
Commit
5bf9c05
·
1 Parent(s): 23379ac

Clean up comment formatting

Browse files
Files changed (1) hide show
  1. app.py +10 -25
app.py CHANGED
@@ -407,14 +407,11 @@ with gr.Blocks(title="CRDT-Merge Convergence Lab", theme=gr.themes.Default(prima
407
  n_partitions = gr.Slider(2, 10, 3, step=1, label="Partitions")
408
  seed = gr.Number(42, label="Seed", precision=0)
409
  skip_slow = gr.Checkbox(True, label="Skip evolutionary strategies (~2 min each on CPU)")
410
- with gr.Row():
411
- run_btn = gr.Button("Run Full Suite", variant="primary", size="lg")
412
- cancel_btn = gr.Button("Cancel", variant="stop", size="lg")
413
  with gr.Column(scale=2):
414
  out_log = gr.Textbox(label="Experiment Log", lines=35, max_lines=80)
415
  out_json = gr.Textbox(label="JSON", lines=10, max_lines=40)
416
- run_event = run_btn.click(run_full_experiment, [n_nodes, tensor_dim, strategy, n_orderings, n_partitions, seed, skip_slow], [out_log, out_json])
417
- cancel_btn.click(fn=None, cancels=[run_event])
418
 
419
  with gr.TabItem("Convergence"):
420
  gr.Markdown("### N nodes merge in different random orderings — all must produce identical results")
@@ -425,14 +422,11 @@ with gr.Blocks(title="CRDT-Merge Convergence Lab", theme=gr.themes.Default(prima
425
  c_s = gr.Dropdown(ALL_STRATEGIES, value="slerp", label="Strategy")
426
  c_o = gr.Slider(2, 20, 8, step=1, label="Orderings")
427
  c_seed = gr.Number(42, label="Seed", precision=0)
428
- with gr.Row():
429
- c_btn = gr.Button("Run", variant="primary")
430
- c_cancel = gr.Button("Cancel", variant="stop")
431
  with gr.Column(scale=2):
432
  c_log = gr.Textbox(label="Log", lines=30, max_lines=60)
433
  c_json = gr.Textbox(label="JSON", lines=8)
434
- c_event = c_btn.click(run_convergence_experiment, [c_n, c_d, c_s, c_o, c_seed], [c_log, c_json])
435
- c_cancel.click(fn=None, cancels=[c_event])
436
 
437
  with gr.TabItem("Partition & Healing"):
438
  gr.Markdown("### Split nodes into isolated partitions, gossip internally, heal, verify convergence")
@@ -443,14 +437,11 @@ with gr.Blocks(title="CRDT-Merge Convergence Lab", theme=gr.themes.Default(prima
443
  p_s = gr.Dropdown(ALL_STRATEGIES, value="ties", label="Strategy")
444
  p_p = gr.Slider(2, 10, 4, step=1, label="Partitions")
445
  p_seed = gr.Number(42, label="Seed", precision=0)
446
- with gr.Row():
447
- p_btn = gr.Button("Run", variant="primary")
448
- p_cancel = gr.Button("Cancel", variant="stop")
449
  with gr.Column(scale=2):
450
  p_log = gr.Textbox(label="Log", lines=30, max_lines=60)
451
  p_json = gr.Textbox(label="JSON", lines=8)
452
- p_event = p_btn.click(run_partition_experiment, [p_n, p_d, p_s, p_p, p_seed], [p_log, p_json])
453
- p_cancel.click(fn=None, cancels=[p_event])
454
 
455
  with gr.TabItem("All 26 Strategies"):
456
  gr.Markdown("### Every merge strategy tested for convergence — 13 base-free + 13 base-required")
@@ -460,14 +451,11 @@ with gr.Blocks(title="CRDT-Merge Convergence Lab", theme=gr.themes.Default(prima
460
  sw_d = gr.Slider(16, 256, 64, step=16, label="Tensor Dim")
461
  sw_seed = gr.Number(42, label="Seed", precision=0)
462
  sw_skip = gr.Checkbox(True, label="Skip evolutionary strategies (~2 min each)")
463
- with gr.Row():
464
- sw_btn = gr.Button("Run Sweep", variant="primary")
465
- sw_cancel = gr.Button("Cancel", variant="stop")
466
  with gr.Column(scale=2):
467
  sw_log = gr.Textbox(label="Log", lines=30, max_lines=60)
468
  sw_json = gr.Textbox(label="JSON", lines=8)
469
- sw_event = sw_btn.click(run_strategy_sweep, [sw_n, sw_d, sw_seed, sw_skip], [sw_log, sw_json])
470
- sw_cancel.click(fn=None, cancels=[sw_event])
471
 
472
  with gr.TabItem("Scalability"):
473
  gr.Markdown("### Measure convergence overhead from 2 to N nodes")
@@ -477,14 +465,11 @@ with gr.Blocks(title="CRDT-Merge Convergence Lab", theme=gr.themes.Default(prima
477
  sc_d = gr.Slider(16, 256, 64, step=16, label="Tensor Dim")
478
  sc_s = gr.Dropdown(ALL_STRATEGIES, value="weight_average", label="Strategy")
479
  sc_seed = gr.Number(42, label="Seed", precision=0)
480
- with gr.Row():
481
- sc_btn = gr.Button("Run Benchmark", variant="primary")
482
- sc_cancel = gr.Button("Cancel", variant="stop")
483
  with gr.Column(scale=2):
484
  sc_log = gr.Textbox(label="Log", lines=30, max_lines=60)
485
  sc_json = gr.Textbox(label="JSON", lines=8)
486
- sc_event = sc_btn.click(run_scale_benchmark, [sc_m, sc_d, sc_s, sc_seed], [sc_log, sc_json])
487
- sc_cancel.click(fn=None, cancels=[sc_event])
488
 
489
  gr.Markdown("---\n**crdt-merge** v0.9.4 | [GitHub](https://github.com/mgillr/crdt-merge) | [PyPI](https://pypi.org/project/crdt-merge/) | Built by Ryan Gillespie / Optitransfer | Patent Pending: UK 2607132.4")
490
 
 
407
  n_partitions = gr.Slider(2, 10, 3, step=1, label="Partitions")
408
  seed = gr.Number(42, label="Seed", precision=0)
409
  skip_slow = gr.Checkbox(True, label="Skip evolutionary strategies (~2 min each on CPU)")
410
+ run_btn = gr.Button("Run Full Suite", variant="primary", size="lg")
 
 
411
  with gr.Column(scale=2):
412
  out_log = gr.Textbox(label="Experiment Log", lines=35, max_lines=80)
413
  out_json = gr.Textbox(label="JSON", lines=10, max_lines=40)
414
+ run_btn.click(run_full_experiment, [n_nodes, tensor_dim, strategy, n_orderings, n_partitions, seed, skip_slow], [out_log, out_json])
 
415
 
416
  with gr.TabItem("Convergence"):
417
  gr.Markdown("### N nodes merge in different random orderings — all must produce identical results")
 
422
  c_s = gr.Dropdown(ALL_STRATEGIES, value="slerp", label="Strategy")
423
  c_o = gr.Slider(2, 20, 8, step=1, label="Orderings")
424
  c_seed = gr.Number(42, label="Seed", precision=0)
425
+ c_btn = gr.Button("Run", variant="primary")
 
 
426
  with gr.Column(scale=2):
427
  c_log = gr.Textbox(label="Log", lines=30, max_lines=60)
428
  c_json = gr.Textbox(label="JSON", lines=8)
429
+ c_btn.click(run_convergence_experiment, [c_n, c_d, c_s, c_o, c_seed], [c_log, c_json])
 
430
 
431
  with gr.TabItem("Partition & Healing"):
432
  gr.Markdown("### Split nodes into isolated partitions, gossip internally, heal, verify convergence")
 
437
  p_s = gr.Dropdown(ALL_STRATEGIES, value="ties", label="Strategy")
438
  p_p = gr.Slider(2, 10, 4, step=1, label="Partitions")
439
  p_seed = gr.Number(42, label="Seed", precision=0)
440
+ p_btn = gr.Button("Run", variant="primary")
 
 
441
  with gr.Column(scale=2):
442
  p_log = gr.Textbox(label="Log", lines=30, max_lines=60)
443
  p_json = gr.Textbox(label="JSON", lines=8)
444
+ p_btn.click(run_partition_experiment, [p_n, p_d, p_s, p_p, p_seed], [p_log, p_json])
 
445
 
446
  with gr.TabItem("All 26 Strategies"):
447
  gr.Markdown("### Every merge strategy tested for convergence — 13 base-free + 13 base-required")
 
451
  sw_d = gr.Slider(16, 256, 64, step=16, label="Tensor Dim")
452
  sw_seed = gr.Number(42, label="Seed", precision=0)
453
  sw_skip = gr.Checkbox(True, label="Skip evolutionary strategies (~2 min each)")
454
+ sw_btn = gr.Button("Run Sweep", variant="primary")
 
 
455
  with gr.Column(scale=2):
456
  sw_log = gr.Textbox(label="Log", lines=30, max_lines=60)
457
  sw_json = gr.Textbox(label="JSON", lines=8)
458
+ sw_btn.click(run_strategy_sweep, [sw_n, sw_d, sw_seed, sw_skip], [sw_log, sw_json])
 
459
 
460
  with gr.TabItem("Scalability"):
461
  gr.Markdown("### Measure convergence overhead from 2 to N nodes")
 
465
  sc_d = gr.Slider(16, 256, 64, step=16, label="Tensor Dim")
466
  sc_s = gr.Dropdown(ALL_STRATEGIES, value="weight_average", label="Strategy")
467
  sc_seed = gr.Number(42, label="Seed", precision=0)
468
+ sc_btn = gr.Button("Run Benchmark", variant="primary")
 
 
469
  with gr.Column(scale=2):
470
  sc_log = gr.Textbox(label="Log", lines=30, max_lines=60)
471
  sc_json = gr.Textbox(label="JSON", lines=8)
472
+ sc_btn.click(run_scale_benchmark, [sc_m, sc_d, sc_s, sc_seed], [sc_log, sc_json])
 
473
 
474
  gr.Markdown("---\n**crdt-merge** v0.9.4 | [GitHub](https://github.com/mgillr/crdt-merge) | [PyPI](https://pypi.org/project/crdt-merge/) | Built by Ryan Gillespie / Optitransfer | Patent Pending: UK 2607132.4")
475