File size: 2,736 Bytes
2bbd13c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
import streamlit as st
import pandas as pd
from pathlib import Path

DATA_DIR = Path("mlip_arena/tasks/diatomics")
methods = ["MACE-MP", "Equiformer", "CHGNet", "MACE-OFF"]
dfs = [pd.read_json(DATA_DIR / method.lower() /  "homonuclear-diatomics.json") for method in methods]
df = pd.concat(dfs, ignore_index=True)

table = pd.DataFrame(columns=["Model", "No. of supported elements", "No. of reversed forces", "Energy-consistent forces"])

for method in df["method"].unique():
    rows = df[df["method"] == method]
    new_row = {
        "Model": method,
        "No. of supported elements": len(rows["name"].unique()),
        "No. of reversed forces": None,  # Replace with actual logic if available
        "Energy-consistent forces": None  # Replace with actual logic if available
    }
    table = pd.concat([table, pd.DataFrame([new_row])], ignore_index=True)



# Define the data
# data = {
#     "Metrics": [
#         "No. of supported elements",
#         "No. of reversed forces",
#         "Energy-consistent forces",
#     ],
#     "MACE-MP(M)": ["10", "5", "Yes"],
#     "CHGNet": ["20", "3", "No"],
#     "Equiformer": ["15", "7", "Yes"]
# }

# # Convert the data to a DataFrame
# df = pd.DataFrame(data)

# # Set the 'Metrics' column as the index
# df.set_index("Metrics", inplace=True)

# # Transpose the DataFrame
# df = df.T

# Apply custom CSS to center the table
# Create the Streamlit table

table.set_index("Model", inplace=True)


s = table.style.background_gradient(
    cmap="Spectral", 
    subset=["No. of supported elements"],
    vmin=0, vmax=120
)


st.markdown("# Leaderboard")
st.dataframe(s, use_container_width=True)

# Define custom CSS for table
# custom_css = """
# <style>
# table {
#     width: 100%;
#     border-collapse: collapse;
# }
# th, td {
#     border: 1px solid #ddd;
#     padding: 8px;
# }
# th {
#     background-color: #4CAF50;
#     color: white;
#     text-align: left;
# }
# tr:nth-child(even) {
#     background-color: #f2f2f2;
# }
# tr:hover {
#     background-color: #ddd;
# }
# </style>
# """

# # Display the table with custom CSS
# st.markdown(custom_css, unsafe_allow_html=True)
# st.markdown(table.to_html(index=False), unsafe_allow_html=True)





# import numpy as np
# import plotly.figure_factory as ff
# import streamlit as st

# st.markdown("# Dashboard")

# # Add histogram data
# x1 = np.random.randn(200) - 2
# x2 = np.random.randn(200)
# x3 = np.random.randn(200) + 2

# # Group data together
# hist_data = [x1, x2, x3]

# group_labels = ["Group 1", "Group 2", "Group 3"]

# # Create distplot with custom bin_size
# fig = ff.create_distplot(
#     hist_data, group_labels, bin_size=[.1, .25, .5]
# )

# # Plot!
# st.plotly_chart(fig, use_container_width=True)