dvilasuero HF staff commited on
Commit
393821f
1 Parent(s): 2bb119f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -6
app.py CHANGED
@@ -95,6 +95,30 @@ def donut_chart() -> alt.Chart:
95
  return chart
96
 
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
 
99
 
100
  def kpi_chart() -> alt.Chart:
@@ -177,12 +201,22 @@ def main() -> None:
177
  <h3> {remaining} records to reach the target</h3>
178
  """
179
  )
180
- plot = gr.Plot(label="Plot")
181
- demo.load(
182
- donut_chart,
183
- inputs=[],
184
- outputs=[plot],
185
- )
 
 
 
 
 
 
 
 
 
 
186
 
187
  gr.Markdown(
188
  """
 
95
  return chart
96
 
97
 
98
+ def kpi_chart_submitted() -> alt.Chart:
99
+ """
100
+ This function returns a KPI chart with the total amount of annotators.
101
+ Returns:
102
+ An altair chart with the KPI chart.
103
+ """
104
+
105
+ # Obtain the total amount of annotators
106
+ _, target_dataset = obtain_source_target_datasets()
107
+
108
+ total = len(target_dataset)
109
+
110
+ # Assuming you have a DataFrame with user data, create a sample DataFrame
111
+ data = pd.DataFrame({"Category": ["Total completed"], "Value": [total]})
112
+
113
+ # Create Altair chart
114
+ chart = (
115
+ alt.Chart(data)
116
+ .mark_text(fontSize=100, align="center", baseline="middle", color="steelblue")
117
+ .encode(text="Value:N")
118
+ .properties(title="Total completed", width=250, height=200)
119
+ )
120
+
121
+ return chart
122
 
123
 
124
  def kpi_chart() -> alt.Chart:
 
201
  <h3> {remaining} records to reach the target</h3>
202
  """
203
  )
204
+ with gr.Row():
205
+
206
+ plot = gr.Plot(label="Plot")
207
+ demo.load(
208
+ kpi_chart_submitted,
209
+ inputs=[],
210
+ outputs=[plot],
211
+ )
212
+
213
+ plot2 = gr.Plot(label="Plot")
214
+ demo.load(
215
+ kpi_chart,
216
+ inputs=[],
217
+ outputs=[plot2],
218
+ )
219
+
220
 
221
  gr.Markdown(
222
  """