ignacioct commited on
Commit
bcdfbc2
β€’
1 Parent(s): a158778

new version of the dashboard, showing annotated record to community target

Browse files
Files changed (1) hide show
  1. app.py +67 -5
app.py CHANGED
@@ -65,7 +65,14 @@ def get_user_annotations_dictionary(
65
  return output
66
 
67
 
68
- def donut_chart() -> alt.Chart:
 
 
 
 
 
 
 
69
 
70
  # Load your data
71
  annotated_records = len(target_dataset)
@@ -97,9 +104,48 @@ def donut_chart() -> alt.Chart:
97
  return chart
98
 
99
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  def kpi_chart_remaining() -> alt.Chart:
101
  """
102
- This function returns a KPI chart with the total amount of annotators.
103
  Returns:
104
  An altair chart with the KPI chart.
105
  """
@@ -121,7 +167,7 @@ def kpi_chart_remaining() -> alt.Chart:
121
 
122
  def kpi_chart_submitted() -> alt.Chart:
123
  """
124
- This function returns a KPI chart with the total amount of annotators.
125
  Returns:
126
  An altair chart with the KPI chart.
127
  """
@@ -217,9 +263,25 @@ def main() -> None:
217
  If you want to contribute to OSS AI, join [the Prompt Collective HF Space](https://huggingface.co/spaces/DIBT/prompt-collective).
218
  """
219
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  gr.Markdown(
221
  f"""
222
- ## πŸš€ Progress
223
  Here's what the community has achieved so far!
224
  """
225
  )
@@ -241,7 +303,7 @@ def main() -> None:
241
 
242
  plot2 = gr.Plot(label="Plot")
243
  demo.load(
244
- donut_chart,
245
  inputs=[],
246
  outputs=[plot2],
247
  )
 
65
  return output
66
 
67
 
68
+ def donut_chart_total() -> alt.Chart:
69
+ """
70
+ This function returns a donut chart with the progress of the total annotations.
71
+ Counts each record that has been annotated at least once.
72
+
73
+ Returns:
74
+ An altair chart with the donut chart.
75
+ """
76
 
77
  # Load your data
78
  annotated_records = len(target_dataset)
 
104
  return chart
105
 
106
 
107
+ def donut_chart_target() -> alt.Chart:
108
+ """
109
+ This function returns a donut chart with the progress of the target annotations.
110
+ Counts each annotation response as an independent annotation.
111
+
112
+ Returns:
113
+ An altair chart with the donut chart.
114
+ """
115
+
116
+ # Load your data
117
+ annotated_records = sum(user_ids_annotations.values())
118
+ pending_records = int(os.getenv("TARGET_ANNOTATIONS_V1")) - annotated_records
119
+
120
+ # Prepare data for the donut chart
121
+ source = pd.DataFrame(
122
+ {
123
+ "values": [annotated_records, pending_records],
124
+ "category": ["Completed", "Remaining"],
125
+ "colors": ["#4CAF50", "#757575"], # Green for Completed, Grey for Remaining
126
+ }
127
+ )
128
+
129
+ base = alt.Chart(source).encode(
130
+ theta=alt.Theta("values:Q", stack=True),
131
+ radius=alt.Radius(
132
+ "values", scale=alt.Scale(type="sqrt", zero=True, rangeMin=20)
133
+ ),
134
+ color=alt.Color("category:N", legend=alt.Legend(title="Category")),
135
+ )
136
+
137
+ c1 = base.mark_arc(innerRadius=20, stroke="#fff")
138
+
139
+ c2 = base.mark_text(radiusOffset=10).encode(text="values:Q")
140
+
141
+ chart = c1 + c2
142
+
143
+ return chart
144
+
145
+
146
  def kpi_chart_remaining() -> alt.Chart:
147
  """
148
+ This function returns a KPI chart with the remaining amount of records to be annotated.
149
  Returns:
150
  An altair chart with the KPI chart.
151
  """
 
167
 
168
  def kpi_chart_submitted() -> alt.Chart:
169
  """
170
+ This function returns a KPI chart with the total amount of records that have been annotated.
171
  Returns:
172
  An altair chart with the KPI chart.
173
  """
 
263
  If you want to contribute to OSS AI, join [the Prompt Collective HF Space](https://huggingface.co/spaces/DIBT/prompt-collective).
264
  """
265
  )
266
+
267
+ gr.Markdown(
268
+ f"""
269
+ ## πŸ“Š Target for Releasing Dataset v1
270
+ How close are we to the target for version 1.0?
271
+ """
272
+ )
273
+ with gr.Row():
274
+
275
+ plot2 = gr.Plot(label="Plot")
276
+ demo.load(
277
+ donut_chart_target,
278
+ inputs=[],
279
+ outputs=[plot2],
280
+ )
281
+
282
  gr.Markdown(
283
  f"""
284
+ ## πŸš€ Global Progress
285
  Here's what the community has achieved so far!
286
  """
287
  )
 
303
 
304
  plot2 = gr.Plot(label="Plot")
305
  demo.load(
306
+ donut_chart_total,
307
  inputs=[],
308
  outputs=[plot2],
309
  )