Spaces:
Running
Running
1Suro1
commited on
Commit
•
61a2dd5
1
Parent(s):
db30e6a
add oauth
Browse files- README.md +3 -0
- app.py +13 -7
- src/display/css_html_js.py +7 -0
README.md
CHANGED
@@ -18,4 +18,7 @@ space_ci:
|
|
18 |
tags:
|
19 |
- leaderboard
|
20 |
short_description: Evaluate open LLMs using arena-hard
|
|
|
|
|
|
|
21 |
---
|
|
|
18 |
tags:
|
19 |
- leaderboard
|
20 |
short_description: Evaluate open LLMs using arena-hard
|
21 |
+
hf_oauth: true
|
22 |
+
hf_oauth_scopes:
|
23 |
+
- read-repos
|
24 |
---
|
app.py
CHANGED
@@ -18,9 +18,11 @@ def handle_file_upload(file):
|
|
18 |
v = json.load(f)
|
19 |
return v, file_path
|
20 |
|
21 |
-
def submit_file(v, file_path,
|
|
|
|
|
22 |
new_file = v['results']
|
23 |
-
new_file['model'] =
|
24 |
new_file['moviesmc'] = new_file['moviemc']["acc,none"]
|
25 |
new_file['musicmc'] = new_file['musicmc']["acc,none"]
|
26 |
new_file['booksmc'] = new_file['bookmc']["acc,none"]
|
@@ -108,7 +110,7 @@ def build_demo():
|
|
108 |
gr.Markdown("# ✨ Submit your model here!", elem_classes="markdown-text")
|
109 |
|
110 |
with gr.Column():
|
111 |
-
|
112 |
# def upload_file(file,su,mn):
|
113 |
# file_path = file.name.split("/")[-1] if "/" in file.name else file.name
|
114 |
# logging.info("New submition: file saved to %s", file_path)
|
@@ -135,9 +137,9 @@ def build_demo():
|
|
135 |
# )
|
136 |
# os.environ[RESET_JUDGEMENT_ENV] = "1"
|
137 |
# return file.name
|
138 |
-
|
139 |
model_name_textbox = gr.Textbox(label="Model name")
|
140 |
-
submitter_username = gr.Textbox(label="Username")
|
141 |
|
142 |
# def toggle_upload_button(model_name, username):
|
143 |
# return bool(model_name) and bool(username)
|
@@ -145,7 +147,11 @@ def build_demo():
|
|
145 |
# upload_button = gr.Button("Click to Upload & Submit Answers", elem_id="upload_button",variant='primary')
|
146 |
uploaded_file = gr.State()
|
147 |
file_path = gr.State()
|
148 |
-
|
|
|
|
|
|
|
|
|
149 |
|
150 |
submit_button = gr.Button("Submit File", elem_id="submit_button", variant='primary')
|
151 |
|
@@ -157,7 +163,7 @@ def build_demo():
|
|
157 |
|
158 |
submit_button.click(
|
159 |
submit_file,
|
160 |
-
[uploaded_file, file_path,
|
161 |
[out]
|
162 |
)
|
163 |
|
|
|
18 |
v = json.load(f)
|
19 |
return v, file_path
|
20 |
|
21 |
+
def submit_file(v, file_path, mn, profile: gr.OAuthProfile | None):
|
22 |
+
if profile is None:
|
23 |
+
return "Hub Login Required"
|
24 |
new_file = v['results']
|
25 |
+
new_file['model'] = profile.username + "/" + mn
|
26 |
new_file['moviesmc'] = new_file['moviemc']["acc,none"]
|
27 |
new_file['musicmc'] = new_file['musicmc']["acc,none"]
|
28 |
new_file['booksmc'] = new_file['bookmc']["acc,none"]
|
|
|
110 |
gr.Markdown("# ✨ Submit your model here!", elem_classes="markdown-text")
|
111 |
|
112 |
with gr.Column():
|
113 |
+
|
114 |
# def upload_file(file,su,mn):
|
115 |
# file_path = file.name.split("/")[-1] if "/" in file.name else file.name
|
116 |
# logging.info("New submition: file saved to %s", file_path)
|
|
|
137 |
# )
|
138 |
# os.environ[RESET_JUDGEMENT_ENV] = "1"
|
139 |
# return file.name
|
140 |
+
# gr.LoginButton()
|
141 |
model_name_textbox = gr.Textbox(label="Model name")
|
142 |
+
# submitter_username = gr.Textbox(label="Username")
|
143 |
|
144 |
# def toggle_upload_button(model_name, username):
|
145 |
# return bool(model_name) and bool(username)
|
|
|
147 |
# upload_button = gr.Button("Click to Upload & Submit Answers", elem_id="upload_button",variant='primary')
|
148 |
uploaded_file = gr.State()
|
149 |
file_path = gr.State()
|
150 |
+
with gr.Row():
|
151 |
+
with gr.Column():
|
152 |
+
out = gr.Textbox("Статус отправки")
|
153 |
+
with gr.Column():
|
154 |
+
login_button = gr.LoginButton(elem_id="oauth-button")
|
155 |
|
156 |
submit_button = gr.Button("Submit File", elem_id="submit_button", variant='primary')
|
157 |
|
|
|
163 |
|
164 |
submit_button.click(
|
165 |
submit_file,
|
166 |
+
[uploaded_file, file_path, model_name_textbox],
|
167 |
[out]
|
168 |
)
|
169 |
|
src/display/css_html_js.py
CHANGED
@@ -80,6 +80,13 @@ table th:first-child {
|
|
80 |
#box-filter > .form{
|
81 |
border: 0
|
82 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
"""
|
84 |
|
85 |
get_window_url_params = """
|
|
|
80 |
#box-filter > .form{
|
81 |
border: 0
|
82 |
}
|
83 |
+
#oauth-button {
|
84 |
+
height: 100%;
|
85 |
+
min-width: 100%;
|
86 |
+
white-space: nowrap;
|
87 |
+
padding: 10px 20px;
|
88 |
+
border-radius: 4px;
|
89 |
+
}
|
90 |
"""
|
91 |
|
92 |
get_window_url_params = """
|