loodvanniekerkginkgo commited on
Commit
1bcb06b
·
1 Parent(s): 4ce3a3e

Modified template and got MVP up

Browse files
Dockerfile CHANGED
@@ -14,12 +14,21 @@ ENV HOME=/home/user \
14
 
15
  WORKDIR $HOME/app
16
 
 
 
17
  RUN pip install --no-cache-dir --upgrade pip
18
- COPY --chown=user . $HOME/app
19
 
 
 
20
  RUN pip install -r requirements.txt
21
 
 
 
22
  EXPOSE 7860
23
  ENV GRADIO_SERVER_NAME="0.0.0.0"
24
 
25
- CMD ["python", "app.py"]
 
 
 
 
 
14
 
15
  WORKDIR $HOME/app
16
 
17
+ # Note(Lood): Mount with -v "$PWD:/home/user/app" to overwrite the COPY below
18
+
19
  RUN pip install --no-cache-dir --upgrade pip
 
20
 
21
+ # Enable quick rebuilds by only copying requirements in this layer
22
+ COPY --chown=user requirements.txt $HOME/app
23
  RUN pip install -r requirements.txt
24
 
25
+ COPY --chown=user . $HOME/app
26
+
27
  EXPOSE 7860
28
  ENV GRADIO_SERVER_NAME="0.0.0.0"
29
 
30
+ # CMD ["python", "app.py"]
31
+ # Running with gradio enables hot reloading (https://www.gradio.app/guides/developing-faster-with-reload-mode)
32
+ CMD ["gradio", "app.py"]
33
+ # Or just run the container without the entrypoint and rerun the python app.py command when you want to reload
34
+
__pycache__/about.cpython-311.pyc ADDED
Binary file (767 Bytes). View file
 
__pycache__/evaluation.cpython-311.pyc ADDED
Binary file (481 Bytes). View file
 
__pycache__/submit.cpython-311.pyc ADDED
Binary file (4.06 kB). View file
 
__pycache__/utils.cpython-311.pyc ADDED
Binary file (3.2 kB). View file
 
__pycache__/visualize.cpython-311.pyc ADDED
Binary file (679 Bytes). View file
 
about.py CHANGED
@@ -1,10 +1,10 @@
1
  import os
2
  from huggingface_hub import HfApi
3
 
4
- PROBLEM_TYPES = ["geometrical", "simple_to_build", "mhd_stable"]
5
  TOKEN = os.environ.get("HF_TOKEN")
6
  CACHE_PATH=os.getenv("HF_HOME", ".")
7
  API = HfApi(token=TOKEN)
8
- organization="proxima-fusion"
9
- submissions_repo = f'{organization}/constellaration-bench-submissions'
10
- results_repo = f'{organization}/constellaration-bench-results'
 
1
  import os
2
  from huggingface_hub import HfApi
3
 
4
+ ASSAY_LIST = ["AC-SINS_pH7.4", "PSP_CHO", "HIC", "Tm2", "Titer"]
5
  TOKEN = os.environ.get("HF_TOKEN")
6
  CACHE_PATH=os.getenv("HF_HOME", ".")
7
  API = HfApi(token=TOKEN)
8
+ organization="ginkgo-datapoints"
9
+ submissions_repo = f'{organization}/abdev-bench-submissions'
10
+ results_repo = f'{organization}/abdev-bench-results'
app.py CHANGED
@@ -1,22 +1,13 @@
1
- import pathlib
2
  from pathlib import Path
3
- import tempfile
4
- from typing import BinaryIO, Literal
5
  import json
6
  import pandas as pd
7
 
8
  import gradio as gr
9
- from datasets import load_dataset
10
- from gradio_leaderboard import ColumnFilter, Leaderboard, SelectColumns
11
  from evaluation import evaluate_problem
12
- from datetime import datetime
13
- import os
14
 
15
- from submit import submit_boundary
16
- from about import PROBLEM_TYPES, TOKEN, CACHE_PATH, API, submissions_repo, results_repo
17
- from utils import read_submission_from_hub, read_result_from_hub, write_results, get_user, make_user_clickable, make_boundary_clickable
18
- from visualize import make_visual
19
- from evaluation import load_boundary, load_boundaries
20
 
21
  def evaluate_boundary(filename):
22
  print(filename)
@@ -33,159 +24,152 @@ def evaluate_boundary(filename):
33
  write_results(data_dict, result)
34
  return
35
 
36
- def get_leaderboard():
37
- ds = load_dataset(results_repo, split='train', download_mode="force_redownload")
38
- full_df = pd.DataFrame(ds)
39
- full_df['full results'] = full_df['result_filename'].apply(lambda x: make_boundary_clickable(x)).astype(str)
40
 
41
- full_df.rename(columns={'submission_time': 'submission time', 'problem_type': 'problem type'}, inplace=True)
42
- to_show = full_df.copy(deep=True)
43
- to_show = to_show[to_show['user'] != 'test']
44
- to_show = to_show[['submission time', 'problem type', 'user', 'score', 'full results']]
45
- to_show['user'] = to_show['user'].apply(lambda x: make_user_clickable(x)).astype(str)
46
-
47
- return to_show
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  def show_output_box(message):
50
  return gr.update(value=message, visible=True)
51
 
52
- def gradio_interface() -> gr.Blocks:
53
- with gr.Blocks() as demo:
54
- gr.Markdown("## Welcome to the ConStellaration Boundary Leaderboard!")
55
- with gr.Tabs(elem_classes="tab-buttons"):
56
- with gr.TabItem("🚀 Leaderboard", elem_id="boundary-benchmark-tab-table"):
57
- gr.Markdown("# Boundary Design Leaderboard")
58
-
59
- Leaderboard(
60
- value=get_leaderboard(),
61
- datatype=['date', 'str', 'html', 'number', 'html'],
62
- select_columns=["submission time", "problem type", "user", "score", "full results"],
63
- search_columns=["submission time", "score", "user"],
64
- # hide_columns=["result_filename", "submission_filename", "objective", "minimize_objective", "boundary_json", "evaluated"],
65
- filter_columns=["problem type"],
66
- every=60,
67
- render=True
68
- )
69
-
70
- gr.Markdown("For the `geometrical` and `simple_to_build`, the scores are bounded between 0.0 and 1.0, where 1.0 is the best possible score. For the `mhd_stable` multi-objective problem, the score is unbounded with a undefined maximum score.")
71
-
72
- with gr.TabItem("❔About", elem_id="boundary-benchmark-tab-table"):
73
- gr.Markdown(
74
- """
75
- ## About This Challenge
76
-
77
- **Welcome to the ConStellaration Leaderboard**, a community-driven effort to accelerate fusion energy research using machine learning.
78
-
79
- In collaboration with [Proxima Fusion](https://www.proximafusion.com/), we're inviting the ML and physics communities to optimize plasma configurations for stellarators—a class of fusion reactors that offer steady-state operation and strong stability advantages over tokamaks.
80
-
81
- This leaderboard tracks submissions to a series of open benchmark tasks focused on:
82
-
83
- - **Geometrically optimized stellarators**
84
- - **Simple-to-build quasi-isodynamic (QI) stellarators**
85
- - **Multi-objective, MHD-stable QI stellarators**
86
-
87
- Participants are encouraged to build surrogate models, optimize plasma boundaries, and explore differentiable design pipelines that could replace or accelerate slow traditional solvers like VMEC++.
88
-
89
- ### Why It Matters
90
-
91
- Fusion promises clean, abundant, zero-carbon energy. But designing stellarators is computationally intense and geometrically complex. With open datasets, reference baselines, and your contributions, we can reimagine this process as fast, iterative, and ML-native.
92
-
93
- ### How to Participate
94
-
95
- - Clone the [ConStellaration dataset](https://huggingface.co/datasets/proxima-fusion/constellaration)
96
- - Build or train your model on the provided QI equilibria
97
- - Submit your predicted boundaries and results here to benchmark against others
98
- - Join the discussion and help expand the frontier of fusion optimization
99
-
100
- Let's bring fusion down to Earth—together.
101
-
102
- """
103
- )
104
-
105
- # dropdown = gr.Dropdown(choices=filenames, label="Choose a file")
106
- # plot_output = gr.Plot()
107
-
108
- with gr.TabItem("🔍 Visualize", elem_id="boundary-benchmark-tab-table"):
109
- ds = load_dataset(results_repo, split='train', download_mode="force_redownload")
110
- full_df = pd.DataFrame(ds)
111
- filenames = full_df['result_filename'].to_list()
112
- with gr.Row():
113
- with gr.Column():
114
- dropdown = gr.Dropdown(choices=filenames, label="Choose a leaderboard entry", value=filenames[0])
115
- rld_btn = gr.Button(value="Reload")
116
-
117
- with gr.Column():
118
- plot = gr.Plot()
119
-
120
- def get_boundary_vis(selected_file):
121
- local_path = read_result_from_hub(selected_file)
122
- with Path(local_path).open("r") as f:
123
- raw = f.read()
124
- data_dict = json.loads(raw)
125
- boundary_json = data_dict['boundary_json']
126
-
127
- if data_dict['problem_type'] == 'mhd_stable':
128
- raise gr.Error("Sorry this isn't implemented for mhd_stable submissions yet!")
129
- else:
130
- boundary = load_boundary(boundary_json)
131
-
132
- vis = make_visual(boundary)
133
- return vis
134
-
135
- demo.load(get_boundary_vis, dropdown, plot)
136
- rld_btn.click(get_boundary_vis, dropdown, plot)
137
-
138
- with gr.TabItem("✉️ Submit", elem_id="boundary-benchmark-tab-table"):
139
- gr.Markdown(
140
- """
141
- # Plasma Boundary Evaluation Submission
142
- Upload your plasma boundary JSON and select the problem type to get your score.
143
  """
144
- )
145
- filename = gr.State(value=None)
146
- eval_state = gr.State(value=None)
147
- user_state = gr.State(value=None)
148
-
149
- # gr.LoginButton()
150
-
151
- with gr.Row():
152
- with gr.Column():
153
- problem_type = gr.Dropdown(PROBLEM_TYPES, label="Problem Type")
154
- username_input = gr.Textbox(
155
- label="Username",
156
- placeholder="Enter your Hugging Face username",
157
- info="This will be displayed on the leaderboard."
158
- )
159
- with gr.Column():
160
- boundary_file = gr.File(label="Boundary JSON File (.json)")
161
-
162
- username_input.change(
163
- fn=lambda x: x if x.strip() else None,
164
- inputs=username_input,
165
- outputs=user_state
166
- )
167
-
168
- submit_btn = gr.Button("Evaluate")
169
- message = gr.Textbox(label="Status", lines=1, visible=False)
170
- # help message
171
- gr.Markdown("If you have issues with submission or using the leaderboard, please start a discussion in the Community tab of this Space.")
172
-
173
- submit_btn.click(
174
- submit_boundary,
175
- inputs=[problem_type, boundary_file, user_state],
176
- outputs=[message, filename],
177
- ).then(
178
- fn=show_output_box,
179
- inputs=[message],
180
- outputs=[message],
181
- ).then(
182
- fn=evaluate_boundary,
183
- inputs=[filename],
184
- outputs=[eval_state]
185
- )
186
-
187
- return demo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
 
189
 
190
  if __name__ == "__main__":
191
- gradio_interface().launch()
 
 
1
  from pathlib import Path
 
 
2
  import json
3
  import pandas as pd
4
 
5
  import gradio as gr
6
+ from gradio_leaderboard import Leaderboard
 
7
  from evaluation import evaluate_problem
 
 
8
 
9
+ from utils import read_submission_from_hub, write_results
10
+ from about import ASSAY_LIST
 
 
 
11
 
12
  def evaluate_boundary(filename):
13
  print(filename)
 
24
  write_results(data_dict, result)
25
  return
26
 
27
+ def get_leaderboard_table(assay: str | None = None):
28
+ # ds = load_dataset(results_repo, split='train', download_mode="force_redownload")
29
+ # full_df = pd.DataFrame(ds)
30
+ # full_df['full results'] = full_df['result_filename'].apply(lambda x: make_boundary_clickable(x)).astype(str)
31
 
32
+ # full_df.rename(columns={'submission_time': 'submission time', 'problem_type': 'problem type'}, inplace=True)
33
+ # to_show = full_df.copy(deep=True)
34
+ # to_show = to_show[to_show['user'] != 'test']
35
+ # to_show = to_show[['submission time', 'problem type', 'user', 'score', 'full results']]
36
+ # to_show['user'] = to_show['user'].apply(lambda x: make_user_clickable(x)).astype(str)
37
+
38
+ # Previously hosted on HF hub, local for now
39
+ column_order = ["model", "feature", "assay", "spearman"]
40
+ df = pd.read_csv("data/metrics_all.csv")
41
+ if assay is not None:
42
+ df = df[df['assay'] == assay]
43
+ df = df[column_order]
44
+ print(df.head())
45
+ return df
46
+
47
+ def get_leaderboard_object(assay: str | None = None):
48
+ df = get_leaderboard_table(assay=assay)
49
+ filter_columns = ["model"]
50
+ if assay is None:
51
+ filter_columns.append("assay")
52
+ Leaderboard(
53
+ value=df,
54
+ datatype=["str", "str", "str", "number"],
55
+ select_columns=["model", "assay", "feature", "spearman"],
56
+ # hide_columns=["spearman_abs"],
57
+ filter_columns=filter_columns,
58
+ every=60,
59
+ render=True
60
+ )
61
 
62
  def show_output_box(message):
63
  return gr.update(value=message, visible=True)
64
 
65
+ #
66
+ # def gradio_interface() -> gr.Blocks:
67
+ with gr.Blocks() as demo:
68
+ gr.Markdown("## Welcome to the Ginkgo Antibody Developability Benchmark Leaderboard!")
69
+ with gr.Tabs(elem_classes="tab-buttons"):
70
+ with gr.TabItem("🚀 Leaderboard", elem_id="abdev-benchmark-tab-table"):
71
+ gr.Markdown("# Antibody Developability Benchmark Leaderboard")
72
+
73
+ get_leaderboard_object()
74
+
75
+ # gr.Markdown("Extra info here")
76
+
77
+ # Procedurally make these 5 tabs
78
+ for assay in ASSAY_LIST:
79
+ with gr.TabItem(assay, elem_id=f"abdev-benchmark-tab-table"):
80
+ gr.Markdown(f"# {assay}")
81
+ get_leaderboard_object(assay=assay)
82
+
83
+ with gr.TabItem("❔About", elem_id="abdev-benchmark-tab-table"):
84
+ gr.Markdown(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  """
86
+ ## About
87
+ Some info here
88
+ """
89
+ )
90
+
91
+ # dropdown = gr.Dropdown(choices=filenames, label="Choose a file")
92
+ # plot_output = gr.Plot()
93
+
94
+ # with gr.TabItem("🔍 Visualize", elem_id="boundary-benchmark-tab-table"):
95
+ # ds = load_dataset(results_repo, split='train', download_mode="force_redownload")
96
+ # full_df = pd.DataFrame(ds)
97
+ # filenames = full_df['result_filename'].to_list()
98
+ # with gr.Row():
99
+ # with gr.Column():
100
+ # dropdown = gr.Dropdown(choices=filenames, label="Choose a leaderboard entry", value=filenames[0])
101
+ # rld_btn = gr.Button(value="Reload")
102
+
103
+ # with gr.Column():
104
+ # plot = gr.Plot()
105
+
106
+ # def get_boundary_vis(selected_file):
107
+ # local_path = read_result_from_hub(selected_file)
108
+ # with Path(local_path).open("r") as f:
109
+ # raw = f.read()
110
+ # data_dict = json.loads(raw)
111
+ # boundary_json = data_dict['boundary_json']
112
+
113
+ # if data_dict['problem_type'] == 'mhd_stable':
114
+ # raise gr.Error("Sorry this isn't implemented for mhd_stable submissions yet!")
115
+ # else:
116
+ # boundary = load_boundary(boundary_json)
117
+
118
+ # vis = make_visual(boundary)
119
+ # return vis
120
+
121
+ # demo.load(get_boundary_vis, dropdown, plot)
122
+ # rld_btn.click(get_boundary_vis, dropdown, plot)
123
+
124
+ # with gr.TabItem("✉️ Submit", elem_id="boundary-benchmark-tab-table"):
125
+ # gr.Markdown(
126
+ # """
127
+ # # Plasma Boundary Evaluation Submission
128
+ # Upload your plasma boundary JSON and select the problem type to get your score.
129
+ # """
130
+ # )
131
+ # filename = gr.State(value=None)
132
+ # eval_state = gr.State(value=None)
133
+ # user_state = gr.State(value=None)
134
+
135
+ # # gr.LoginButton()
136
+
137
+ # with gr.Row():
138
+ # with gr.Column():
139
+ # problem_type = gr.Dropdown(PROBLEM_TYPES, label="Problem Type")
140
+ # username_input = gr.Textbox(
141
+ # label="Username",
142
+ # placeholder="Enter your Hugging Face username",
143
+ # info="This will be displayed on the leaderboard."
144
+ # )
145
+ # with gr.Column():
146
+ # boundary_file = gr.File(label="Boundary JSON File (.json)")
147
+
148
+ # username_input.change(
149
+ # fn=lambda x: x if x.strip() else None,
150
+ # inputs=username_input,
151
+ # outputs=user_state
152
+ # )
153
+
154
+ # submit_btn = gr.Button("Evaluate")
155
+ # message = gr.Textbox(label="Status", lines=1, visible=False)
156
+ # # help message
157
+ # gr.Markdown("If you have issues with submission or using the leaderboard, please start a discussion in the Community tab of this Space.")
158
+
159
+ # submit_btn.click(
160
+ # submit_boundary,
161
+ # inputs=[problem_type, boundary_file, user_state],
162
+ # outputs=[message, filename],
163
+ # ).then(
164
+ # fn=show_output_box,
165
+ # inputs=[message],
166
+ # outputs=[message],
167
+ # ).then(
168
+ # fn=evaluate_boundary,
169
+ # inputs=[filename],
170
+ # outputs=[eval_state]
171
+ # )
172
 
173
 
174
  if __name__ == "__main__":
175
+ demo.launch()
data/metrics_all.csv ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ spearman,feature,assay,model,spearman_abs
2
+ -0.358762795727933,PNC - tap,AC-SINS_pH7.4,tap,0.358762795727933
3
+ -0.358762795727933,PNC - tap,AC-SINS_pH7.4,tap,0.358762795727933
4
+ 0.3203773185543964,SFvCSP - tap,AC-SINS_pH7.4,tap,0.3203773185543964
5
+ 0.3203773185543964,SFvCSP - tap,AC-SINS_pH7.4,tap,0.3203773185543964
6
+ -0.2450651623577951,SFvCSP - tap,HIC,tap,0.2450651623577951
7
+ 0.2381972244142228,SFvCSP - tap,PR_CHO,tap,0.2381972244142228
8
+ 0.1923458958277369,CDR Length - tap,HIC,tap,0.1923458958277369
9
+ -0.1839687842860175,PPC - tap,HIC,tap,0.1839687842860175
10
+ 0.1691412287169806,PPC - tap,AC-SINS_pH7.4,tap,0.1691412287169806
11
+ 0.1691412287169806,PPC - tap,AC-SINS_pH7.4,tap,0.1691412287169806
12
+ -0.151234196032203,PNC - tap,PR_CHO,tap,0.151234196032203
13
+ -0.1501689804134715,CDR Length - tap,AC-SINS_pH7.4,tap,0.1501689804134715
14
+ -0.1501689804134715,CDR Length - tap,AC-SINS_pH7.4,tap,0.1501689804134715
15
+ 0.1423756688786398,PPC - tap,Titer,tap,0.1423756688786398
16
+ 0.1144051722170351,predictions,HIC,hic_mockup,0.1144051722170351
17
+ 0.1144051722170351,predictions,HIC,hic_mockup,0.1144051722170351
18
+ -0.1043862069630446,PNC - tap,Titer,tap,0.1043862069630446
19
+ 0.0885325199884014,PPC - tap,PR_CHO,tap,0.0885325199884014
20
+ 0.0797623802296775,SFvCSP - tap,Titer,tap,0.0797623802296775
21
+ -0.0729274519946903,CDR Length - tap,Tm2,tap,0.0729274519946903
22
+ -0.0638862853735791,PSH - tap,Titer,tap,0.0638862853735791
23
+ -0.0524556823713343,CDR Length - tap,PR_CHO,tap,0.0524556823713343
24
+ -0.0482259337861972,PNC - tap,Tm2,tap,0.0482259337861972
25
+ -0.0464732086283245,PSH - tap,HIC,tap,0.0464732086283245
26
+ -0.0415639454664855,CDR Length - tap,Titer,tap,0.0415639454664855
27
+ -0.0360881689253704,PSH - tap,AC-SINS_pH7.4,tap,0.0360881689253704
28
+ -0.0360881689253704,PSH - tap,AC-SINS_pH7.4,tap,0.0360881689253704
29
+ -0.0317350623491362,PSH - tap,Tm2,tap,0.0317350623491362
30
+ 0.0209381900169799,PSH - tap,PR_CHO,tap,0.0209381900169799
31
+ -0.0179541460075494,SFvCSP - tap,Tm2,tap,0.0179541460075494
32
+ 0.0102627218889135,PNC - tap,HIC,tap,0.0102627218889135
33
+ -0.0098872681569066,PPC - tap,Tm2,tap,0.0098872681569066
evaluation.py CHANGED
@@ -1,42 +1,30 @@
1
  import json
2
  from pathlib import Path
3
 
4
- from constellaration import problems
5
- from constellaration.geometry import surface_rz_fourier
6
-
7
- PROBLEM_TYPES = ["geometrical", "simple_to_build", "mhd_stable"]
8
-
9
- def load_boundary(data: str) -> surface_rz_fourier.SurfaceRZFourier:
10
- return surface_rz_fourier.SurfaceRZFourier.model_validate_json(data)
11
-
12
- def load_boundaries(data: str) -> list[surface_rz_fourier.SurfaceRZFourier]:
13
- data_json = json.loads(data)
14
- return [
15
- surface_rz_fourier.SurfaceRZFourier.model_validate_json(b) for b in data_json
16
- ]
17
-
18
  def evaluate_problem(
19
  problem_type: str, input_file: str
20
- ) -> problems.EvaluationSingleObjective | problems.EvaluationMultiObjective:
21
- with Path(input_file).open("r") as f:
22
- raw = f.read()
23
- data_dict = json.loads(raw)
24
- data = data_dict['boundary_json']
 
 
25
 
26
- print("Starting evaluation.")
27
 
28
- match problem_type:
29
- case "geometrical":
30
- boundary = load_boundary(data)
31
- result = problems.GeometricalProblem().evaluate(boundary)
32
- case "simple_to_build":
33
- boundary = load_boundary(data)
34
- result = problems.SimpleToBuildQIStellarator().evaluate(boundary)
35
- case "mhd_stable":
36
- boundaries = load_boundaries(data)
37
- result = problems.MHDStableQIStellarator().evaluate(boundaries)
38
- case _:
39
- raise ValueError(f"Unknown problem type: {problem_type}")
40
 
41
- print("Finished evaluation.")
42
- return result
 
1
  import json
2
  from pathlib import Path
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  def evaluate_problem(
5
  problem_type: str, input_file: str
6
+ # ) -> problems.EvaluationSingleObjective | problems.EvaluationMultiObjective:
7
+ ):
8
+ pass
9
+ # with Path(input_file).open("r") as f:
10
+ # raw = f.read()
11
+ # data_dict = json.loads(raw)
12
+ # data = data_dict['boundary_json']
13
 
14
+ # print("Starting evaluation.")
15
 
16
+ # match problem_type:
17
+ # case "geometrical":
18
+ # boundary = load_boundary(data)
19
+ # result = problems.GeometricalProblem().evaluate(boundary)
20
+ # case "simple_to_build":
21
+ # boundary = load_boundary(data)
22
+ # result = problems.SimpleToBuildQIStellarator().evaluate(boundary)
23
+ # case "mhd_stable":
24
+ # boundaries = load_boundaries(data)
25
+ # result = problems.MHDStableQIStellarator().evaluate(boundaries)
26
+ # case _:
27
+ # raise ValueError(f"Unknown problem type: {problem_type}")
28
 
29
+ # print("Finished evaluation.")
30
+ # return result
requirements.txt CHANGED
@@ -1,6 +1,5 @@
1
- constellaration==0.2.1
2
  gradio
3
  datasets
4
  huggingface_hub
5
  gradio-leaderboard
6
- plotly
 
 
1
  gradio
2
  datasets
3
  huggingface_hub
4
  gradio-leaderboard
5
+ # plotly
utils.py CHANGED
@@ -1,25 +1,19 @@
1
  import pathlib
2
- from pathlib import Path
3
  import tempfile
4
- from typing import BinaryIO, Literal
5
  import json
6
- import pandas as pd
7
 
8
  import gradio as gr
9
- from huggingface_hub import upload_file, hf_hub_download
10
- from evaluation import evaluate_problem
11
- from datetime import datetime
12
- import os
13
 
14
- from about import PROBLEM_TYPES, TOKEN, CACHE_PATH, API, submissions_repo, results_repo
15
 
16
- def make_user_clickable(name):
17
- link =f'https://huggingface.co/{name}'
18
- return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{name}</a>'
19
 
20
- def make_boundary_clickable(filename):
21
- link =f'https://huggingface.co/datasets/proxima-fusion/constellaration-bench-results/blob/main/{filename}'
22
- return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">link</a>'
23
 
24
  def read_result_from_hub(filename):
25
  local_path = hf_hub_download(
 
1
  import pathlib
 
2
  import tempfile
 
3
  import json
 
4
 
5
  import gradio as gr
6
+ from huggingface_hub import hf_hub_download
 
 
 
7
 
8
+ from about import API, submissions_repo, results_repo
9
 
10
+ # def make_user_clickable(name):
11
+ # link =f'https://huggingface.co/{name}'
12
+ # return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">{name}</a>'
13
 
14
+ # def make_boundary_clickable(filename):
15
+ # link =f'https://huggingface.co/datasets/proxima-fusion/constellaration-bench-results/blob/main/{filename}'
16
+ # return f'<a target="_blank" href="{link}" style="color: var(--link-text-color); text-decoration: underline;text-decoration-style: dotted;">link</a>'
17
 
18
  def read_result_from_hub(filename):
19
  local_path = hf_hub_download(
visualize.py DELETED
@@ -1,12 +0,0 @@
1
- from constellaration.utils import (
2
- file_exporter,
3
- visualization,
4
- visualization_utils,
5
- )
6
- import gradio as gr
7
- import plotly.graph_objects as go
8
-
9
- def make_visual(boundary):
10
- vis = visualization.plot_surface(boundary)
11
- # div = vis.to_html(full_html=False)
12
- return vis