Spaces:
Sleeping
Sleeping
chan030609
commited on
Commit
·
5c6e7ab
1
Parent(s):
b826bd5
bug fix
Browse files- app.py +4 -2
- submission/books.csv +1 -1
- submission/news.csv +1 -1
- uploads.py +5 -10
- utils.py +9 -5
app.py
CHANGED
@@ -4,7 +4,7 @@ import os
|
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
from huggingface_hub import HfApi
|
6 |
from uploads import add_new_eval
|
7 |
-
from utils import LEADERBOARD_PATH, CORPORA, load_data
|
8 |
|
9 |
|
10 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results."
|
@@ -45,7 +45,9 @@ with demo:
|
|
45 |
)
|
46 |
|
47 |
leaderboard_table = gr.components.Dataframe(
|
48 |
-
value=load_data(CORPORA[0])
|
|
|
|
|
49 |
interactive=True,
|
50 |
visible=True,
|
51 |
)
|
|
|
4 |
from apscheduler.schedulers.background import BackgroundScheduler
|
5 |
from huggingface_hub import HfApi
|
6 |
from uploads import add_new_eval
|
7 |
+
from utils import LEADERBOARD_PATH, CORPORA, load_data, DEFAULT_COLUMNS, DEFAULT_COLUMN_LABELS
|
8 |
|
9 |
|
10 |
CITATION_BUTTON_LABEL = "Copy the following snippet to cite these results."
|
|
|
45 |
)
|
46 |
|
47 |
leaderboard_table = gr.components.Dataframe(
|
48 |
+
value=load_data(CORPORA[0]).rename(columns={
|
49 |
+
k: v for k, v in zip(DEFAULT_COLUMNS, DEFAULT_COLUMN_LABELS)
|
50 |
+
}),
|
51 |
interactive=True,
|
52 |
visible=True,
|
53 |
)
|
submission/books.csv
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
target,Baseline,99.8,59.4,-57.5,66.9,"-"
|
3 |
retrain,Baseline,14.3,28.9,0.0,74.5,"-"
|
4 |
"ga (epoch=1, lr=1e-5, bs=32)",Baseline,0.0,0.0,-25.0,0.0,"-"
|
|
|
1 |
+
name,organization,verbmem_f,knowmem_f,privleak,knowmem_r,id
|
2 |
target,Baseline,99.8,59.4,-57.5,66.9,"-"
|
3 |
retrain,Baseline,14.3,28.9,0.0,74.5,"-"
|
4 |
"ga (epoch=1, lr=1e-5, bs=32)",Baseline,0.0,0.0,-25.0,0.0,"-"
|
submission/news.csv
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
|
2 |
target,Baseline,58.4,63.9,-99.8,55.2,"-"
|
3 |
retrain,Baseline,20.8,33.1,0.0,55.0,"-"
|
4 |
"ga (epoch=1, lr=1e-5, bs=32)",Baseline,0.0,0.0,5.2,0.0,"-"
|
|
|
1 |
+
name,organization,verbmem_f,knowmem_f,privleak,knowmem_r,id
|
2 |
target,Baseline,58.4,63.9,-99.8,55.2,"-"
|
3 |
retrain,Baseline,20.8,33.1,0.0,55.0,"-"
|
4 |
"ga (epoch=1, lr=1e-5, bs=32)",Baseline,0.0,0.0,5.2,0.0,"-"
|
uploads.py
CHANGED
@@ -4,7 +4,7 @@ import io
|
|
4 |
import os
|
5 |
import base64
|
6 |
import pandas as pd
|
7 |
-
from utils import DEFAULT_METRICS, LEADERBOARD_PATH
|
8 |
|
9 |
|
10 |
api = HfApi()
|
@@ -46,18 +46,13 @@ def add_new_eval(
|
|
46 |
df = pd.read_csv(io_path)
|
47 |
df_new = pd.read_csv(fpath)
|
48 |
|
49 |
-
for col in
|
50 |
if col not in df_new.columns:
|
51 |
return format_warning(f"Missing column in the submitted file: {col}")
|
52 |
|
53 |
-
df_new['
|
54 |
-
df_new['
|
55 |
-
df_new = df_new
|
56 |
-
columns={
|
57 |
-
k: v for k, v in zip(DEFAULT_METRICS, DEFAULT_METRIC_LABELS)
|
58 |
-
} | {'name': 'Method Name'}
|
59 |
-
)
|
60 |
-
df_new = df_new[['Method Name', 'Submitted By'] + DEFAULT_METRIC_LABELS + ['Id']]
|
61 |
|
62 |
df = pd.concat([df, df_new]).reset_index(drop=True)
|
63 |
buffer = io.BytesIO()
|
|
|
4 |
import os
|
5 |
import base64
|
6 |
import pandas as pd
|
7 |
+
from utils import DEFAULT_COLUMNS, DEFAULT_METRICS, LEADERBOARD_PATH
|
8 |
|
9 |
|
10 |
api = HfApi()
|
|
|
46 |
df = pd.read_csv(io_path)
|
47 |
df_new = pd.read_csv(fpath)
|
48 |
|
49 |
+
for col in DEFAULT_METRICS:
|
50 |
if col not in df_new.columns:
|
51 |
return format_warning(f"Missing column in the submitted file: {col}")
|
52 |
|
53 |
+
df_new['organization'] = organization
|
54 |
+
df_new['id'] = base64.b64encode(os.urandom(6)).decode('ascii')
|
55 |
+
df_new = df_new[DEFAULT_COLUMNS]
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
df = pd.concat([df, df_new]).reset_index(drop=True)
|
58 |
buffer = io.BytesIO()
|
utils.py
CHANGED
@@ -6,14 +6,19 @@ DEFAULT_METRICS = [
|
|
6 |
'verbmem_f',
|
7 |
'knowmem_f',
|
8 |
'privleak',
|
9 |
-
'knowmem_r'
|
10 |
]
|
11 |
|
12 |
-
|
|
|
|
|
|
|
|
|
13 |
'VerbMem ⬇️',
|
14 |
'KnowMem Forget ⬇️',
|
15 |
'PrivLeak',
|
16 |
-
'KnowMem Retain (Utility) ⬆'
|
|
|
17 |
]
|
18 |
|
19 |
CORPORA = ['news', 'books']
|
@@ -22,5 +27,4 @@ CORPORA = ['news', 'books']
|
|
22 |
def load_data(corpus):
|
23 |
assert corpus in CORPORA
|
24 |
df = pd.read_csv(f"submission/{corpus}.csv")
|
25 |
-
|
26 |
-
return df
|
|
|
6 |
'verbmem_f',
|
7 |
'knowmem_f',
|
8 |
'privleak',
|
9 |
+
'knowmem_r',
|
10 |
]
|
11 |
|
12 |
+
DEFAULT_COLUMNS = ['name', 'organization'] + DEFAULT_METRICS + ['id']
|
13 |
+
|
14 |
+
DEFAULT_COLUMN_LABELS = [
|
15 |
+
'Method Name',
|
16 |
+
'Submitted By',
|
17 |
'VerbMem ⬇️',
|
18 |
'KnowMem Forget ⬇️',
|
19 |
'PrivLeak',
|
20 |
+
'KnowMem Retain (Utility) ⬆',
|
21 |
+
'Submission Id'
|
22 |
]
|
23 |
|
24 |
CORPORA = ['news', 'books']
|
|
|
27 |
def load_data(corpus):
|
28 |
assert corpus in CORPORA
|
29 |
df = pd.read_csv(f"submission/{corpus}.csv")
|
30 |
+
return df[DEFAULT_COLUMNS]
|
|