Commit
•
f438fdb
1
Parent(s):
23af3c5
add render of redirect in leaderboard to users
Browse files
app.py
CHANGED
@@ -1,12 +1,19 @@
|
|
1 |
# app dashboard from https://huggingface.co/spaces/davanstrien/argilla-progress/blob/main/app.py
|
2 |
import os
|
3 |
-
from typing import List
|
4 |
|
5 |
import argilla as rg
|
6 |
import gradio as gr
|
7 |
import pandas as pd
|
8 |
import plotly.graph_objects as go
|
9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
client = rg.Argilla(
|
11 |
api_url=os.getenv("ARGILLA_API_URL"),
|
12 |
api_key=os.getenv("ARGILLA_API_KEY"),
|
@@ -162,8 +169,6 @@ def get_datasets(client: rg.Argilla) -> List[rg.Dataset]:
|
|
162 |
|
163 |
datasets = get_datasets(client)
|
164 |
|
165 |
-
from typing import Optional
|
166 |
-
|
167 |
|
168 |
def update_dashboard(dataset_idx: Optional[int] = None):
|
169 |
if dataset_idx is None:
|
@@ -179,6 +184,10 @@ def update_dashboard(dataset_idx: Optional[int] = None):
|
|
179 |
list(progress["users"].items()), columns=["User", "Submitted records"]
|
180 |
)
|
181 |
|
|
|
|
|
|
|
|
|
182 |
leaderboard_df = leaderboard_df.sort_values(
|
183 |
"Submitted records", ascending=False
|
184 |
).reset_index(drop=True)
|
@@ -206,7 +215,10 @@ with gr.Blocks() as demo:
|
|
206 |
gr.Markdown("## Contributor Leaderboard")
|
207 |
|
208 |
with gr.Row():
|
209 |
-
leaderboard_output = gr.Dataframe(
|
|
|
|
|
|
|
210 |
piechart_output = gr.Plot(label="User contributions")
|
211 |
|
212 |
demo.load(
|
|
|
1 |
# app dashboard from https://huggingface.co/spaces/davanstrien/argilla-progress/blob/main/app.py
|
2 |
import os
|
3 |
+
from typing import List, Optional
|
4 |
|
5 |
import argilla as rg
|
6 |
import gradio as gr
|
7 |
import pandas as pd
|
8 |
import plotly.graph_objects as go
|
9 |
|
10 |
+
os.environ["ARGILLA_API_URL"] = (
|
11 |
+
"https://data-is-better-together-image-preferences.hf.space/"
|
12 |
+
)
|
13 |
+
os.environ["ARGILLA_API_KEY"] = (
|
14 |
+
"AbwS-x_-ttKOsoxIi-tbX9MdOBzSBvCFHe91QWKaAtrFo2KppKpl1gSoG-wCBSASWVJzNBLxKaBPzo7SVxnvGUAxmytsbQ5SlJREGbZVB1o"
|
15 |
+
)
|
16 |
+
|
17 |
client = rg.Argilla(
|
18 |
api_url=os.getenv("ARGILLA_API_URL"),
|
19 |
api_key=os.getenv("ARGILLA_API_KEY"),
|
|
|
169 |
|
170 |
datasets = get_datasets(client)
|
171 |
|
|
|
|
|
172 |
|
173 |
def update_dashboard(dataset_idx: Optional[int] = None):
|
174 |
if dataset_idx is None:
|
|
|
184 |
list(progress["users"].items()), columns=["User", "Submitted records"]
|
185 |
)
|
186 |
|
187 |
+
leaderboard_df["User"] = leaderboard_df["User"].apply(
|
188 |
+
lambda x: f"[{x}](https://huggingface.co/{x})"
|
189 |
+
)
|
190 |
+
|
191 |
leaderboard_df = leaderboard_df.sort_values(
|
192 |
"Submitted records", ascending=False
|
193 |
).reset_index(drop=True)
|
|
|
215 |
gr.Markdown("## Contributor Leaderboard")
|
216 |
|
217 |
with gr.Row():
|
218 |
+
leaderboard_output = gr.Dataframe(
|
219 |
+
headers=["User", "Submitted records"],
|
220 |
+
datatype=["markdown", "markdown", "html"],
|
221 |
+
)
|
222 |
piechart_output = gr.Plot(label="User contributions")
|
223 |
|
224 |
demo.load(
|