Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions viewer/main.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import ast
import os
import re
import hashlib
Expand All @@ -7,6 +8,8 @@
import logging
import json
import subprocess
import threading
import time
from functools import lru_cache
import precompute_trends
import dataset_quality
Expand Down Expand Up @@ -85,8 +88,6 @@ class State:


def df_to_config(df: pd.DataFrame) -> dict:
import ast

original_dict = {}

for _, row in df.iterrows():
Expand Down Expand Up @@ -345,7 +346,7 @@ def status_component():
box_shadow="0 2px 4px rgba(0,0,0,0.05)",
)
):
me.text("Product status", type="headline-5")
me.text("Product Status", type="headline-5")
me.box(style=me.Style(height="16px"))
me.text(f"Total Evaluation Jobs: {len(directories)}")

Expand Down Expand Up @@ -597,8 +598,6 @@ def _pct(value):


def _build_summaries(cache_df):
import re

rows = []
for _, row in cache_df.iterrows():
score = row['ai_score'] if 'ai_score' in row else 0.0
Expand Down Expand Up @@ -2100,7 +2099,6 @@ def on_clear_cache_click(e: me.ClickEvent):

logging.info("Cleared precomputed files. Triggering precompute...")

import threading
threading.Thread(target=precompute_trends.precompute).start()

state.cache_cleared_message = "Cache cleared. Precompute triggered in background."
Expand Down Expand Up @@ -2135,7 +2133,6 @@ def on_clear_cache_click(e: me.ClickEvent):
),
)

import time
cache_file = os.path.join(results_dir, "trends_cache.csv")
cache_status = "Not Ready"
cache_color = "#ef4444" # Red
Expand Down Expand Up @@ -2223,7 +2220,6 @@ def on_generate_summary_click(e: me.ClickEvent):
results_dir_full = os.path.join(results_dir, state.selected_directory)
state.ai_summary = summarize_eval_scoring(results_dir_full)
# Parse score
import re
match = re.search(r"\*\*General Score:\s*(\d+(\.\d+)?)[^*]*\*\*", state.ai_summary)
if match:
state.ai_score = float(match.group(1))
Expand Down Expand Up @@ -2319,7 +2315,6 @@ def get_val(cfg_name):

# Fallback if score was not parsed correctly in cache
if state.ai_score == 0.0 and state.ai_summary:
import re
match = re.search(r"General Score:.*?(\d+(\.\d+)?)", state.ai_summary)
if match:
state.ai_score = float(match.group(1))
Expand All @@ -2339,7 +2334,6 @@ def get_val(cfg_name):
me.text("Formula: 0.4 * goal_completion + 0.2 * trajectory_matcher + 0.2 * behavioral_metrics + 0.2 * parameter_analysis", style=me.Style(font_size="14px", color="#6b7280", margin=me.Margin(bottom="16px")))

# Strip score from summary if present to avoid duplication
import re
clean_summary = re.sub(r"^\s*\*\*General Score:\s*\d+(\.\d+)?[^*]*\*\*\s*", "", state.ai_summary)
me.markdown(clean_summary)

Expand Down Expand Up @@ -2410,6 +2404,7 @@ def on_next_conversation(e: me.ClickEvent):


else:
# Local: trends imports from main, so hoisting this cycles.
from trends import trends_component
state = me.state(State)

Expand Down Expand Up @@ -2476,5 +2471,4 @@ def on_main_tab_change(e: me.ButtonToggleChangeEvent):
except Exception as e:
logging.exception("render_app_content failed")
me.text(f"Fatal Error: {e}")
if __name__ == "__main__":
me.run(app)

16 changes: 0 additions & 16 deletions viewer/state.py

This file was deleted.

Loading