apsys commited on
Commit
0256ee3
1 Parent(s): ef349ee

more ref, ci, debug

Browse files
Files changed (2) hide show
  1. app.py +5 -10
  2. src/submission/submit.py +4 -1
app.py CHANGED
@@ -31,11 +31,8 @@ from src.submission.submit import add_new_eval
31
  loggedin = False
32
 
33
  def check_login(profile: gr.OAuthProfile | None) -> bool:
34
- global loggedin
35
  if profile is None:
36
- loggedin = False
37
  return False
38
- loggedin = True
39
  return True
40
 
41
  def restart_space():
@@ -185,13 +182,11 @@ with demo:
185
  )
186
  base_model_name_textbox = gr.Textbox(label="Организация")
187
  ans_file = gr.File(label="Arena Hard Answer File", file_types=["json","jsonl"])
188
- login_button.click(check_login)
189
- if not loggedin:
190
- gr.Markdown("Please log in to submit an evaluation.")
191
- else:
192
- submit_button = gr.Button("Submit Eval")
193
- submission_result = gr.Markdown()
194
- submit_button.click(
195
  add_new_eval,
196
  [
197
  model_name_textbox,
 
31
  loggedin = False
32
 
33
  def check_login(profile: gr.OAuthProfile | None) -> bool:
 
34
  if profile is None:
 
35
  return False
 
36
  return True
37
 
38
  def restart_space():
 
182
  )
183
  base_model_name_textbox = gr.Textbox(label="Организация")
184
  ans_file = gr.File(label="Arena Hard Answer File", file_types=["json","jsonl"])
185
+ loggedin = login_button.click(check_login)
186
+
187
+ submit_button = gr.Button("Submit Eval")
188
+ submission_result = gr.Markdown()
189
+ submit_button.click(
 
 
190
  add_new_eval,
191
  [
192
  model_name_textbox,
src/submission/submit.py CHANGED
@@ -1,7 +1,7 @@
1
  import json
2
  import os
3
  from datetime import datetime, timezone
4
-
5
  from src.display.formatting import styled_error, styled_message, styled_warning
6
  from src.envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
7
  from src.submission.check_validity import (
@@ -22,7 +22,10 @@ def add_new_eval(
22
  weight_type: str,
23
  model_type: str,
24
  ans_file: str,
 
25
  ):
 
 
26
  global REQUESTED_MODELS
27
  global USERS_TO_SUBMISSION_DATES
28
  if not REQUESTED_MODELS:
 
1
  import json
2
  import os
3
  from datetime import datetime, timezone
4
+ import gradio as gr
5
  from src.display.formatting import styled_error, styled_message, styled_warning
6
  from src.envs import API, EVAL_REQUESTS_PATH, TOKEN, QUEUE_REPO
7
  from src.submission.check_validity import (
 
22
  weight_type: str,
23
  model_type: str,
24
  ans_file: str,
25
+ profile: gr.OAuthProfile | None
26
  ):
27
+ if profile is None:
28
+ return styled_error("Hub Login Required")
29
  global REQUESTED_MODELS
30
  global USERS_TO_SUBMISSION_DATES
31
  if not REQUESTED_MODELS: