Spaces:
Sleeping
Sleeping
File size: 3,125 Bytes
f7832ad 6322afe fe0c719 bc0d85d 6322afe af3a32f 1e29694 af3a32f 1e29694 af3a32f 1e29694 af3a32f da95145 37341c1 da95145 a73977e f7832ad a73977e da95145 f7832ad da95145 f7832ad da95145 f7832ad 6322afe da95145 1638e8f da95145 1638e8f da95145 a73977e da95145 919a76a 407badc a73977e da95145 a73977e da95145 a73977e da95145 1638e8f a73977e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
import streamlit as st
import pandas as pd
import wandb
import time
from datetime import datetime
def get_all_competition_summary(api, projects):
number_of_competitions = 0
number_of_runs = 0
for project in projects:
entity = projects[project]["entity"]
project_name = projects[project]["project"]
runs = api.runs(f"{entity}/{project_name}")
number_of_competitions += 1
number_of_runs += len(runs)
return number_of_competitions,number_of_runs
def fetch_competition_summary(api, projects, selected_project):
data = []
entity = projects[selected_project]["entity"]
project = projects[selected_project]["project"]
runs = api.runs(f"{entity}/{project}")
for run in runs:
try:
summary = run.summary
if summary.get("validator_hotkey") and summary.get("winning_hotkey"):
data.append({
"ID": run.id,
"Validator ID": summary.get("validator_hotkey"),
"Winning Hotkey": summary.get("winning_hotkey"),
"Run Time (s)": summary.get("run_time_s"),
"Created At": run.created_at,
})
except Exception as e:
st.write(f"Error processing run {run.id}: {str(e)}")
df = pd.DataFrame(data)
if not df.empty:
df['Created At'] = pd.to_datetime(df['Created At'])
df = df.sort_values(by="Created At", ascending=False)
return df
def fetch_models_evaluation(api, projects, selected_project):
data = []
entity = projects[selected_project]["entity"]
project = projects[selected_project]["project"]
runs = api.runs(f"{entity}/{project}")
for run in runs:
try:
summary = run.summary
if summary.get("score") is not None: # Assuming runs with score are model evaluations
data.append({
"Created At": run.created_at,
"Miner hotkey": summary.get("miner_hotkey", "N/A"),
"Score": summary.get("score"),
"F1-beta": summary.get("fbeta"),
"Accuracy": summary.get("accuracy"),
"Recall": summary.get("recall"),
"Precision": summary.get("precision"),
"Tested entries": summary.get("tested_entries"),
"ROC AUC": summary.get("roc_auc"),
"Confusion Matrix": summary.get("confusion_matrix"),
#TODO link to huggingface model
})
except Exception as e:
st.write(f"Error processing run {run.id}: {str(e)}")
df = pd.DataFrame(data)
if not df.empty:
df['Created At'] = pd.to_datetime(df['Created At'])
df = df.sort_values(by="Created At", ascending=False)
return df
def highlight_score_column(s):
"""
Highlight the 'Score' column with a custom background color.
"""
return ['background-color: yellow' if s.name == 'Score' else '' for _ in s]
|