Spaces:
Running
Running
Fixed variable mapping
Browse files
app.py
CHANGED
|
@@ -16,6 +16,13 @@ elo_scores = defaultdict(lambda: DEFAULT_ELO)
|
|
| 16 |
vote_counts = defaultdict(int)
|
| 17 |
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Load the model_data from JSONL
|
| 20 |
def load_model_data():
|
| 21 |
model_data = {}
|
|
@@ -342,13 +349,13 @@ with gr.Blocks(theme='default', css=CSS_STYLES) as demo:
|
|
| 342 |
label="Eval Prompt",
|
| 343 |
lines=1,
|
| 344 |
value=DEFAULT_EVAL_PROMPT,
|
| 345 |
-
placeholder="Type your eval prompt here... denote
|
| 346 |
show_label=True
|
| 347 |
)
|
| 348 |
|
| 349 |
# Right column - Variable Mapping
|
| 350 |
with gr.Column(scale=1):
|
| 351 |
-
gr.Markdown("### {{Input
|
| 352 |
# Create inputs for up to 5 variables, with first two visible by default
|
| 353 |
variable_rows = []
|
| 354 |
for i in range(5):
|
|
@@ -421,16 +428,22 @@ with gr.Blocks(theme='default', css=CSS_STYLES) as demo:
|
|
| 421 |
for i in range(5):
|
| 422 |
var_row, var_input = variable_rows[i]
|
| 423 |
if i < len(variables):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 424 |
updates.extend([
|
| 425 |
gr.update(visible=True), # var_row
|
| 426 |
-
gr.update(value=
|
| 427 |
-
gr.update(visible=True) # var_input
|
| 428 |
])
|
| 429 |
else:
|
| 430 |
updates.extend([
|
| 431 |
gr.update(visible=False), # var_row
|
| 432 |
-
gr.update()
|
| 433 |
-
gr.update(visible=False, value="") # var_input
|
| 434 |
])
|
| 435 |
return updates
|
| 436 |
|
|
|
|
| 16 |
vote_counts = defaultdict(int)
|
| 17 |
|
| 18 |
|
| 19 |
+
# Model and ELO score data
|
| 20 |
+
DEFAULT_ELO = 1500 # Starting ELO for new models
|
| 21 |
+
K_FACTOR = 32 # Standard chess K-factor, adjust as needed
|
| 22 |
+
elo_scores = defaultdict(lambda: DEFAULT_ELO)
|
| 23 |
+
vote_counts = defaultdict(int)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
# Load the model_data from JSONL
|
| 27 |
def load_model_data():
|
| 28 |
model_data = {}
|
|
|
|
| 349 |
label="Eval Prompt",
|
| 350 |
lines=1,
|
| 351 |
value=DEFAULT_EVAL_PROMPT,
|
| 352 |
+
placeholder="Type your eval prompt here... denote variables in {{curly brackets}} to be populated on the right.",
|
| 353 |
show_label=True
|
| 354 |
)
|
| 355 |
|
| 356 |
# Right column - Variable Mapping
|
| 357 |
with gr.Column(scale=1):
|
| 358 |
+
gr.Markdown("### {{Input variables}} to be evaluated")
|
| 359 |
# Create inputs for up to 5 variables, with first two visible by default
|
| 360 |
variable_rows = []
|
| 361 |
for i in range(5):
|
|
|
|
| 428 |
for i in range(5):
|
| 429 |
var_row, var_input = variable_rows[i]
|
| 430 |
if i < len(variables):
|
| 431 |
+
# Set default values for 'input' and 'response', otherwise leave empty
|
| 432 |
+
if variables[i] == "input":
|
| 433 |
+
initial_value = DEFAULT_INPUT
|
| 434 |
+
elif variables[i] == "response":
|
| 435 |
+
initial_value = DEFAULT_RESPONSE
|
| 436 |
+
else:
|
| 437 |
+
initial_value = "" # Empty for new variables
|
| 438 |
+
|
| 439 |
updates.extend([
|
| 440 |
gr.update(visible=True), # var_row
|
| 441 |
+
gr.update(value=initial_value, label=variables[i], visible=True) # var_input with dynamic label
|
|
|
|
| 442 |
])
|
| 443 |
else:
|
| 444 |
updates.extend([
|
| 445 |
gr.update(visible=False), # var_row
|
| 446 |
+
gr.update(value="", visible=False) # var_input
|
|
|
|
| 447 |
])
|
| 448 |
return updates
|
| 449 |
|