Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import os
|
2 |
import datetime
|
3 |
import pandas as pd
|
|
|
4 |
import gradio as gr
|
5 |
import argilla as rg
|
6 |
import plotly.graph_objects as go
|
@@ -30,17 +31,15 @@ def get_progress(dataset) -> dict:
|
|
30 |
|
31 |
|
32 |
def get_leaderboard(dataset) -> dict:
|
33 |
-
|
34 |
for record in dataset.records:
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
print(user_annotations)
|
43 |
-
return user_annotations
|
44 |
|
45 |
|
46 |
def create_gauge_chart(progress):
|
|
|
1 |
import os
|
2 |
import datetime
|
3 |
import pandas as pd
|
4 |
+
from collections import Counter
|
5 |
import gradio as gr
|
6 |
import argilla as rg
|
7 |
import plotly.graph_objects as go
|
|
|
31 |
|
32 |
|
33 |
def get_leaderboard(dataset) -> dict:
|
34 |
+
contributions = {}
|
35 |
for record in dataset.records:
|
36 |
+
if record.status == "completed" and record.responses:
|
37 |
+
responses_list = list(record.responses)
|
38 |
+
if responses_list:
|
39 |
+
first_response = responses_list[0]
|
40 |
+
if hasattr(first_response, "user_id"):
|
41 |
+
contributions[record.id] = client.users(id=first_response.user_id).username
|
42 |
+
return dict(Counter(contributions.values()))
|
|
|
|
|
43 |
|
44 |
|
45 |
def create_gauge_chart(progress):
|