RFTSystems commited on
Commit
2f94dbe
·
verified ·
1 Parent(s): fbd80fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -11
app.py CHANGED
@@ -2,13 +2,22 @@ import gradio as gr
2
  import json
3
  import time
4
 
5
- # Load sealed results
6
  with open("results.json") as f:
7
  data = json.load(f)
8
 
9
- def simulate_epochs(difficulty):
 
 
 
 
 
 
 
 
 
10
  results = data[difficulty]
11
- header = "| Epoch | LIAM (RFT) | Adam | Lion | SGR |\n|-------|-------------|------|------|-----|\n"
12
  table = header
13
  for i in range(len(results["epochs"])):
14
  epoch = results["epochs"][i]
@@ -16,19 +25,20 @@ def simulate_epochs(difficulty):
16
  adam = results["Adam"][i]
17
  lion = results["Lion"][i]
18
  sgr = results["SGR"][i]
19
- table += f"| {epoch} | {rft:.2f}% | {adam:.2f}% | {lion:.2f}% | {sgr:.2f}% |\n"
 
20
  yield table
21
- time.sleep(0.75) # Simulate live epoch progression
22
 
23
  demo = gr.Interface(
24
  fn=simulate_epochs,
25
- inputs=gr.Dropdown(
26
- choices=list(data.keys()),
27
- label="Select Difficulty Level"
28
- ),
29
  outputs=gr.Markdown(),
30
- title="RFT Optimizer Showdown",
31
- description="Live epoch simulation comparing DCLR++ (LIAM RFT) vs. Adam, Lion, and SGR across difficulty tiers. All results sealed. No optimizer code exposed.",
32
  live=True
33
  )
34
 
 
2
  import json
3
  import time
4
 
5
+ # Load sealed RFT results
6
  with open("results.json") as f:
7
  data = json.load(f)
8
 
9
+ def simulate_epochs(difficulty, user_log):
10
+ try:
11
+ user_data = json.loads(user_log)
12
+ user_label = user_data.get("label", "User")
13
+ user_epochs = user_data.get("epochs", [])
14
+ user_scores = user_data.get("scores", [])
15
+ except:
16
+ yield "❌ Invalid log format. Please submit a JSON with 'label', 'epochs', and 'scores'."
17
+ return
18
+
19
  results = data[difficulty]
20
+ header = f"| Epoch | LIAM (RFT) | Adam | Lion | SGR | {user_label} |\n|-------|-------------|------|------|-----|--------------|\n"
21
  table = header
22
  for i in range(len(results["epochs"])):
23
  epoch = results["epochs"][i]
 
25
  adam = results["Adam"][i]
26
  lion = results["Lion"][i]
27
  sgr = results["SGR"][i]
28
+ user_score = user_scores[i] if i < len(user_scores) else "-"
29
+ table += f"| {epoch} | {rft:.2f}% | {adam:.2f}% | {lion:.2f}% | {sgr:.2f}% | {user_score} |\n"
30
  yield table
31
+ time.sleep(0.75)
32
 
33
  demo = gr.Interface(
34
  fn=simulate_epochs,
35
+ inputs=[
36
+ gr.Dropdown(choices=list(data.keys()), label="Select Difficulty Level"),
37
+ gr.Textbox(lines=10, label="Paste Your Optimizer Log (JSON)")
38
+ ],
39
  outputs=gr.Markdown(),
40
+ title="RFT Optimizer Showdown – Challenge Mode",
41
+ description="Submit your optimizer log and watch it benchmarked live against RFT, Adam, Lion, and SGR. Format: {\"label\": \"MyOpt\", \"epochs\": [...], \"scores\": [...]}.",
42
  live=True
43
  )
44