Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,8 +3,8 @@ from gradio_leaderboard import Leaderboard, ColumnFilter, SelectColumns, SearchC
|
|
| 3 |
import pandas as pd
|
| 4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 5 |
from huggingface_hub import snapshot_download
|
| 6 |
-
import os
|
| 7 |
-
|
| 8 |
|
| 9 |
from src.about import (
|
| 10 |
CITATION_BUTTON_LABEL,
|
|
@@ -108,12 +108,6 @@ def init_leaderboard(dataframe):
|
|
| 108 |
)
|
| 109 |
|
| 110 |
|
| 111 |
-
# =================test
|
| 112 |
-
if os.path.exists("./text.txt"):
|
| 113 |
-
print(open("./text.txt").read())
|
| 114 |
-
else:
|
| 115 |
-
print("not exists")
|
| 116 |
-
|
| 117 |
|
| 118 |
demo = gr.Blocks(css=custom_css)
|
| 119 |
with demo:
|
|
@@ -162,16 +156,28 @@ with demo:
|
|
| 162 |
|
| 163 |
def submit_eval(score, name, base_model, env, target_research, subset, link):
|
| 164 |
# 在这里处理提交逻辑,可以将信息保存到数据库或进行其他处理
|
| 165 |
-
result =
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
return result
|
| 176 |
|
| 177 |
submit_button.click(
|
|
|
|
| 3 |
import pandas as pd
|
| 4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
| 5 |
from huggingface_hub import snapshot_download
|
| 6 |
+
import os, json
|
| 7 |
+
from src.envs import API
|
| 8 |
|
| 9 |
from src.about import (
|
| 10 |
CITATION_BUTTON_LABEL,
|
|
|
|
| 108 |
)
|
| 109 |
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
demo = gr.Blocks(css=custom_css)
|
| 113 |
with demo:
|
|
|
|
| 156 |
|
| 157 |
def submit_eval(score, name, base_model, env, target_research, subset, link):
|
| 158 |
# 在这里处理提交逻辑,可以将信息保存到数据库或进行其他处理
|
| 159 |
+
result = {
|
| 160 |
+
"Score": score,
|
| 161 |
+
"Name": name,
|
| 162 |
+
"BaseModel": base_model,
|
| 163 |
+
"Env": env,
|
| 164 |
+
"Target-research": target_research,
|
| 165 |
+
"Subset": subset,
|
| 166 |
+
"Link": link,
|
| 167 |
+
"State": "Checking"
|
| 168 |
+
}
|
| 169 |
+
out_path = "test-output.json"
|
| 170 |
+
with open(out_path, "w") as f:
|
| 171 |
+
f.write(json.dumps(result))
|
| 172 |
+
|
| 173 |
+
print("Uploading eval file")
|
| 174 |
+
API.upload_file(
|
| 175 |
+
path_or_fileobj=out_path,
|
| 176 |
+
path_in_repo=out_path,
|
| 177 |
+
repo_id=QUEUE_REPO,
|
| 178 |
+
repo_type="space",
|
| 179 |
+
commit_message=f"Add {result} to checking queue",
|
| 180 |
+
)
|
| 181 |
return result
|
| 182 |
|
| 183 |
submit_button.click(
|