Spaces:
Running
Running
Fixed greyed out Regenerate button first time
Browse files
app.py
CHANGED
|
@@ -16,13 +16,6 @@ elo_scores = defaultdict(lambda: DEFAULT_ELO)
|
|
| 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 = {}
|
|
@@ -495,20 +488,26 @@ with gr.Blocks(theme='default', css=CSS_STYLES) as demo:
|
|
| 495 |
|
| 496 |
# Update the send button handler to store the submitted inputs
|
| 497 |
def submit_and_store(prompt, *variables):
|
| 498 |
-
|
|
|
|
|
|
|
|
|
|
| 499 |
response_a, response_b, buttons_visible, regen_visible, model_a, model_b = submit_prompt(prompt, *variables)
|
| 500 |
|
| 501 |
# Parse the responses
|
| 502 |
score_a, critique_a = parse_model_response(response_a)
|
| 503 |
score_b, critique_b = parse_model_response(response_b)
|
| 504 |
|
|
|
|
|
|
|
|
|
|
| 505 |
return (
|
| 506 |
score_a,
|
| 507 |
critique_a,
|
| 508 |
score_b,
|
| 509 |
critique_b,
|
| 510 |
buttons_visible,
|
| 511 |
-
gr.update(visible=True), # Show regenerate button
|
| 512 |
model_a,
|
| 513 |
model_b,
|
| 514 |
gr.update(value="*Model: Unknown*"),
|
|
|
|
| 16 |
vote_counts = defaultdict(int)
|
| 17 |
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
# Load the model_data from JSONL
|
| 20 |
def load_model_data():
|
| 21 |
model_data = {}
|
|
|
|
| 488 |
|
| 489 |
# Update the send button handler to store the submitted inputs
|
| 490 |
def submit_and_store(prompt, *variables):
|
| 491 |
+
# Create a copy of the current submission
|
| 492 |
+
current_submission = {"prompt": prompt, "variables": variables}
|
| 493 |
+
|
| 494 |
+
# Get the responses
|
| 495 |
response_a, response_b, buttons_visible, regen_visible, model_a, model_b = submit_prompt(prompt, *variables)
|
| 496 |
|
| 497 |
# Parse the responses
|
| 498 |
score_a, critique_a = parse_model_response(response_a)
|
| 499 |
score_b, critique_b = parse_model_response(response_b)
|
| 500 |
|
| 501 |
+
# Update the last_submission state with the current values
|
| 502 |
+
last_submission.value = current_submission
|
| 503 |
+
|
| 504 |
return (
|
| 505 |
score_a,
|
| 506 |
critique_a,
|
| 507 |
score_b,
|
| 508 |
critique_b,
|
| 509 |
buttons_visible,
|
| 510 |
+
gr.update(visible=True, interactive=True), # Show and enable regenerate button
|
| 511 |
model_a,
|
| 512 |
model_b,
|
| 513 |
gr.update(value="*Model: Unknown*"),
|