cgeorgiaw HF Staff commited on
Commit
127c41d
·
1 Parent(s): a01d55c

reorg front end

Browse files
Files changed (3) hide show
  1. about.py +3 -3
  2. app.py +18 -36
  3. requirements.txt +1 -2
about.py CHANGED
@@ -5,6 +5,6 @@ PROBLEM_TYPES = ["unconditional", "conditional"]
5
  TOKEN = os.environ.get("HF_TOKEN")
6
  CACHE_PATH=os.getenv("HF_HOME", ".")
7
  API = HfApi(token=TOKEN)
8
- organization="cgeorgiaw"
9
- submissions_repo = f'{organization}/lemat-bench-submissions'
10
- results_repo = f'{organization}/lemat-bench-results'
 
5
  TOKEN = os.environ.get("HF_TOKEN")
6
  CACHE_PATH=os.getenv("HF_HOME", ".")
7
  API = HfApi(token=TOKEN)
8
+ organization="LeMaterial"
9
+ submissions_repo = f'{organization}/lemat-gen-bench-submissions'
10
+ results_repo = f'{organization}/lemat-gen-bench-results'
app.py CHANGED
@@ -9,52 +9,47 @@ from datetime import datetime
9
  import os
10
 
11
  from about import PROBLEM_TYPES, TOKEN, CACHE_PATH, API, submissions_repo, results_repo
12
- from utils import make_user_clickable, make_boundary_clickable
13
-
14
 
15
  def get_leaderboard():
16
  ds = load_dataset(results_repo, split='train', download_mode="force_redownload")
17
  full_df = pd.DataFrame(ds)
18
- full_df['full results'] = full_df['result_filename'].apply(lambda x: make_boundary_clickable(x)).astype(str)
19
-
20
- full_df.rename(columns={'submission_time': 'submission time', 'problem_type': 'problem type'}, inplace=True)
21
- to_show = full_df.copy(deep=True)
22
- to_show = to_show[to_show['user'] != 'test']
23
- to_show = to_show[['submission time', 'problem type', 'user', 'score', 'full results']]
24
- to_show['user'] = to_show['user'].apply(lambda x: make_user_clickable(x)).astype(str)
25
 
26
- return to_show
27
 
28
  def show_output_box(message):
29
  return gr.update(value=message, visible=True)
30
 
 
 
 
31
  def gradio_interface() -> gr.Blocks:
32
  with gr.Blocks() as demo:
33
- gr.Markdown("## Welcome to the ConStellaration Boundary Leaderboard!")
34
  with gr.Tabs(elem_classes="tab-buttons"):
35
  with gr.TabItem("🚀 Leaderboard", elem_id="boundary-benchmark-tab-table"):
36
- gr.Markdown("# Boundary Design Leaderboard")
37
 
38
  try:
39
  Leaderboard(
40
  value=get_leaderboard(),
41
- datatype=['date', 'str', 'html', 'number', 'html'],
42
- select_columns=["submission time", "problem type", "user", "score", "full results"],
43
- search_columns=["submission time", "score", "user"],
44
- # hide_columns=["result_filename", "submission_filename", "objective", "minimize_objective", "boundary_json", "evaluated"],
45
- filter_columns=["problem type"],
46
  every=60,
47
  render=True
48
  )
49
  except:
50
  gr.Markdown("Leaderboard is empty.")
51
 
52
- 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.")
53
 
54
  with gr.TabItem("❔About", elem_id="boundary-benchmark-tab-table"):
55
  gr.Markdown(
56
  """
57
- ## About LeMat-Bench
58
 
59
  **Welcome to the LeMat-Bench Leaderboard**, There are unconditional generation and conditional generation components of this leaderboard.
60
 
@@ -69,27 +64,14 @@ def gradio_interface() -> gr.Blocks:
69
  """
70
  )
71
  filename = gr.State(value=None)
72
- eval_state = gr.State(value=None)
73
- user_state = gr.State(value=None)
74
 
75
- # gr.LoginButton()
76
 
77
  with gr.Row():
78
  with gr.Column():
79
  problem_type = gr.Dropdown(PROBLEM_TYPES, label="Problem Type")
80
- username_input = gr.Textbox(
81
- label="Username",
82
- placeholder="Enter your Hugging Face username",
83
- info="This will be displayed on the leaderboard."
84
- )
85
  with gr.Column():
86
- boundary_file = gr.File(label="Upload a CSV, a pkl, or a ZIP of CIF files.")
87
-
88
- username_input.change(
89
- fn=lambda x: x if x.strip() else None,
90
- inputs=username_input,
91
- outputs=user_state
92
- )
93
 
94
  submit_btn = gr.Button("Submission")
95
  message = gr.Textbox(label="Status", lines=1, visible=False)
@@ -97,8 +79,8 @@ def gradio_interface() -> gr.Blocks:
97
  gr.Markdown("If you have issues with submission or using the leaderboard, please start a discussion in the Community tab of this Space.")
98
 
99
  submit_btn.click(
100
- submit_boundary,
101
- inputs=[problem_type, boundary_file, user_state],
102
  outputs=[message, filename],
103
  ).then(
104
  fn=show_output_box,
 
9
  import os
10
 
11
  from about import PROBLEM_TYPES, TOKEN, CACHE_PATH, API, submissions_repo, results_repo
 
 
12
 
13
  def get_leaderboard():
14
  ds = load_dataset(results_repo, split='train', download_mode="force_redownload")
15
  full_df = pd.DataFrame(ds)
16
+ if len(full_df) == 0:
17
+ return pd.DataFrame({'date':[], 'model':[], 'score':[], 'verified':[]})
 
 
 
 
 
18
 
19
+ return full_df
20
 
21
  def show_output_box(message):
22
  return gr.update(value=message, visible=True)
23
 
24
+ def submit_cif_files(problem_type, cif_files, profile: gr.OAuthProfile | None):
25
+ return
26
+
27
  def gradio_interface() -> gr.Blocks:
28
  with gr.Blocks() as demo:
29
+ gr.Markdown("## Welcome to the LeMaterial Generative Benchmark Leaderboard!")
30
  with gr.Tabs(elem_classes="tab-buttons"):
31
  with gr.TabItem("🚀 Leaderboard", elem_id="boundary-benchmark-tab-table"):
32
+ gr.Markdown("# LeMat-Gen-Bench")
33
 
34
  try:
35
  Leaderboard(
36
  value=get_leaderboard(),
37
+ datatype=['date', 'model', 'score', 'verified'],
38
+ select_columns=["model"],
39
+ search_columns=["model"],
40
+ filter_columns=["verified"],
 
41
  every=60,
42
  render=True
43
  )
44
  except:
45
  gr.Markdown("Leaderboard is empty.")
46
 
47
+ gr.Markdown("Verified submissions mean the results came from a model submission rather than a CIF submission.")
48
 
49
  with gr.TabItem("❔About", elem_id="boundary-benchmark-tab-table"):
50
  gr.Markdown(
51
  """
52
+ ## About LeMat-Gen-Bench
53
 
54
  **Welcome to the LeMat-Bench Leaderboard**, There are unconditional generation and conditional generation components of this leaderboard.
55
 
 
64
  """
65
  )
66
  filename = gr.State(value=None)
 
 
67
 
68
+ gr.LoginButton()
69
 
70
  with gr.Row():
71
  with gr.Column():
72
  problem_type = gr.Dropdown(PROBLEM_TYPES, label="Problem Type")
 
 
 
 
 
73
  with gr.Column():
74
+ cif_file = gr.File(label="Upload a CSV, a pkl, or a ZIP of CIF files.")
 
 
 
 
 
 
75
 
76
  submit_btn = gr.Button("Submission")
77
  message = gr.Textbox(label="Status", lines=1, visible=False)
 
79
  gr.Markdown("If you have issues with submission or using the leaderboard, please start a discussion in the Community tab of this Space.")
80
 
81
  submit_btn.click(
82
+ submit_cif_files,
83
+ inputs=[problem_type, cif_file],
84
  outputs=[message, filename],
85
  ).then(
86
  fn=show_output_box,
requirements.txt CHANGED
@@ -1,5 +1,4 @@
1
  gradio
2
  datasets
3
  huggingface_hub
4
- gradio-leaderboard
5
- git+https://github.com/LeMaterial/lemat-genbench.git
 
1
  gradio
2
  datasets
3
  huggingface_hub
4
+ gradio-leaderboard