Spaces:
Running
Running
import gradio as gr | |
import plotly.graph_objs as go | |
import json | |
# Dummy data - replace with real model benchmarks later | |
MODEL_EVALS = { | |
"Proteins": { | |
"Nexa Bio1 (Secondary)": 0.71, | |
"Porter6 (Secondary)": 0.8456, | |
"DeepCNF (Secondary)": 0.85, | |
"AlphaFold2 (Tertiary GDT-TS)": 0.924, | |
"Nexa Bio2 (Tertiary)": 0.90, | |
}, | |
"Astro": { | |
"Nexa Astro": 0.97, | |
"Baseline CNN": 0.89, | |
}, | |
"Materials": { | |
"Nexa Materials": 0.9999, | |
"Random Forest Baseline": 0.92, | |
}, | |
"QST": { | |
"Nexa PIN Model": 0.80, | |
"Quantum TomoNet": 0.85, | |
}, | |
"HEP": { | |
"Nexa HEP Model": 0.91, | |
"CMSNet": 0.94, | |
}, | |
"CFD": { | |
"Nexa CFD Model": 0.92, | |
"FlowNet": 0.89, | |
}, | |
} | |
def plot_domain(domain): | |
models = list(MODEL_EVALS[domain].keys()) | |
scores = list(MODEL_EVALS[domain].values()) | |
fig = go.Figure() | |
fig.add_trace(go.Bar(x=models, y=scores, marker_color='indigo')) | |
fig.update_layout( | |
title=f"Model Benchmark Scores β {domain}", | |
xaxis_title="Model", | |
yaxis_title="Score", | |
yaxis_range=[0, 1.0], | |
template="plotly_white", | |
height=500 | |
) | |
return fig | |
def get_model_details(domain): | |
return json.dumps(MODEL_EVALS[domain], indent=2) | |
def display_eval(domain): | |
plot = plot_domain(domain) | |
details = get_model_details(domain) | |
return plot, details | |
domain_list = list(MODEL_EVALS.keys()) | |
with gr.Blocks(title="Nexa Evals β Scientific ML Benchmark Suite") as demo: | |
gr.Markdown(""" | |
# π¬ Nexa Evals | |
A benchmarking suite comparing Nexa models against SOTA across scientific domains. | |
""") | |
with gr.Row(): | |
domain = gr.Dropdown(domain_list, label="Select Domain") | |
show_btn = gr.Button("Run Evaluation") | |
with gr.Row(): | |
plot_output = gr.Plot(label="Benchmark Plot") | |
metrics_output = gr.Code(label="Raw Scores (JSON)", language="json") | |
show_btn.click(display_eval, inputs=domain, outputs=[plot_output, metrics_output]) | |
demo.launch() | |