mariagrandury commited on
Commit
dff615a
·
1 Parent(s): 907ca48

guardar leaderboard en local

Browse files
Files changed (3) hide show
  1. README.md +19 -3
  2. app.py +12 -5
  3. leaderboard.csv +39 -0
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Hackaton Leaderboard
3
  emoji: 🏆
4
  colorFrom: gray
5
  colorTo: purple
@@ -7,5 +7,21 @@ sdk: gradio
7
  sdk_version: 4.44.1
8
  app_file: app.py
9
  pinned: false
10
- short_description: Leaderboard resultados hackaton
11
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Leaderboard Retos Hackathon SomosNLP 2025
3
  emoji: 🏆
4
  colorFrom: gray
5
  colorTo: purple
 
7
  sdk_version: 4.44.1
8
  app_file: app.py
9
  pinned: false
10
+ short_description: Leaderboard Retos Hackathon SomosNLP 2025
11
+ ---
12
+
13
+ # Leaderboard Retos Hackathon SomosNLP 2025
14
+
15
+ ## Build
16
+
17
+ ```bash
18
+ # Install dependencies
19
+ pip install -r requirements.txt
20
+
21
+ # Run locally
22
+ python app.py
23
+
24
+ # Or use Docker
25
+ docker build -t leaderboard .
26
+ docker run -p 7860:7860 leaderboard
27
+ ```
app.py CHANGED
@@ -25,7 +25,8 @@ DATA_DIR = "data"
25
  INCLUDE_CSV = os.path.join(DATA_DIR, "include.csv")
26
  STEREOTYPES_CSV = os.path.join(DATA_DIR, "stereotypes.csv")
27
  ARENA_JSON = os.path.join(DATA_DIR, "arena.json")
28
- PARTICIPANTS_CSV = os.path.join(DATA_DIR, "mail_to_username.csv")
 
29
 
30
  countries = {
31
  "Argentina": {"iso": "ARG", "emoji": "🇦🇷"},
@@ -101,14 +102,16 @@ def get_include_data():
101
  try:
102
  if os.path.exists(INCLUDE_CSV):
103
  include_df = pd.read_csv(INCLUDE_CSV)
 
 
104
  if (
105
- "Nombre en Discord / username" in include_df.columns
106
- and "Número de preguntas / number of questions" in include_df.columns
107
  ):
108
  discord_users = defaultdict(int)
109
  for _, row in include_df.iterrows():
110
- username = row["Nombre en Discord / username"][1:]
111
- questions = row["Número de preguntas / number of questions"]
112
  if pd.notna(username) and pd.notna(questions):
113
  discord_users[username.lower()] += int(questions)
114
 
@@ -116,6 +119,7 @@ def get_include_data():
116
  data.append(
117
  {"source": "include", "username": username, "count": count}
118
  )
 
119
  except Exception as e:
120
  print(f"Error loading {INCLUDE_CSV}: {e}")
121
 
@@ -261,6 +265,9 @@ def consolidate_all_data():
261
  if not df.empty:
262
  df = df.sort_values("Total", ascending=False)
263
 
 
 
 
264
  return df
265
 
266
 
 
25
  INCLUDE_CSV = os.path.join(DATA_DIR, "include.csv")
26
  STEREOTYPES_CSV = os.path.join(DATA_DIR, "stereotypes.csv")
27
  ARENA_JSON = os.path.join(DATA_DIR, "arena.json")
28
+ PARTICIPANTS_CSV = os.path.join(DATA_DIR, "participants.csv")
29
+ LEADERBOARD_CSV = os.path.join(".", "leaderboard.csv")
30
 
31
  countries = {
32
  "Argentina": {"iso": "ARG", "emoji": "🇦🇷"},
 
102
  try:
103
  if os.path.exists(INCLUDE_CSV):
104
  include_df = pd.read_csv(INCLUDE_CSV)
105
+ username_column = "Nombre en Discord / username"
106
+ questions_column = "Total preguntas hackathon"
107
  if (
108
+ username_column in include_df.columns
109
+ and questions_column in include_df.columns
110
  ):
111
  discord_users = defaultdict(int)
112
  for _, row in include_df.iterrows():
113
+ username = row[username_column][1:] # Remove the @ symbol
114
+ questions = row[questions_column]
115
  if pd.notna(username) and pd.notna(questions):
116
  discord_users[username.lower()] += int(questions)
117
 
 
119
  data.append(
120
  {"source": "include", "username": username, "count": count}
121
  )
122
+
123
  except Exception as e:
124
  print(f"Error loading {INCLUDE_CSV}: {e}")
125
 
 
265
  if not df.empty:
266
  df = df.sort_values("Total", ascending=False)
267
 
268
+ with open(LEADERBOARD_CSV, "w", encoding="utf-8") as f:
269
+ df.to_csv(f, index=False)
270
+
271
  return df
272
 
273
 
leaderboard.csv ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Username,Total,Blend-es,INCLUDE,Estereotipos,Arena
2
+ bea esparcia,206,0,0,126,80
3
+ andres_seba,190,0,0,70,120
4
+ jj,168,0,0,85,83
5
+ roverico,141,0,0,1,140
6
+ steminism,133,0,0,0,133
7
+ neovalleltd,122,0,0,122,0
8
+ mcdaqc,118,0,0,0,118
9
+ alexis_castillo,68,0,0,68,0
10
+ angustias22,63,0,0,0,63
11
+ henry mantilla,58,0,0,0,58
12
+ elena w.,57,0,0,57,0
13
+ fabianpp,50,0,0,0,50
14
+ alvaro8gb,44,0,0,2,42
15
+ enpaiva93,43,0,0,3,40
16
+ adriszmar,42,0,0,20,22
17
+ ghuerta170,35,0,0,0,35
18
+ edmenciab,30,0,0,0,30
19
+ alebravo,30,0,0,30,0
20
+ jedzill4,27,0,0,27,0
21
+ gonznm,24,0,0,24,0
22
+ luceldasilva,23,0,0,0,23
23
+ agumeister,21,0,0,21,0
24
+ helenpy,19,0,0,0,19
25
+ danielcavilla,19,0,0,0,19
26
+ jorge.vallego,14,0,0,14,0
27
+ jorgeav,13,0,0,13,0
28
+ maria isabel ll,12,0,0,12,0
29
+ gonzalo_40146,8,0,0,0,8
30
+ clauvallory,5,0,0,5,0
31
+ dramos7,5,0,0,5,0
32
+ lucase#5596,3,0,0,3,0
33
+ daelsand,2,0,0,2,0
34
+ da.qc,2,0,0,2,0
35
+ gfuentes2000,1,0,0,0,1
36
+ gonzalo.fuentes,1,0,0,0,1
37
+ freddyalfonsoboulton,1,0,0,1,0
38
+ yee51,1,0,0,1,0
39
+ valaery,1,0,0,1,0