Commit
•
ed6456c
1
Parent(s):
393821f
Update app.py
Browse files
app.py
CHANGED
@@ -94,6 +94,28 @@ def donut_chart() -> alt.Chart:
|
|
94 |
|
95 |
return chart
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
|
98 |
def kpi_chart_submitted() -> alt.Chart:
|
99 |
"""
|
@@ -210,9 +232,17 @@ def main() -> None:
|
|
210 |
outputs=[plot],
|
211 |
)
|
212 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
213 |
plot2 = gr.Plot(label="Plot")
|
214 |
demo.load(
|
215 |
-
|
216 |
inputs=[],
|
217 |
outputs=[plot2],
|
218 |
)
|
|
|
94 |
|
95 |
return chart
|
96 |
|
97 |
+
def kpi_chart_remaining() -> alt.Chart:
|
98 |
+
"""
|
99 |
+
This function returns a KPI chart with the total amount of annotators.
|
100 |
+
Returns:
|
101 |
+
An altair chart with the KPI chart.
|
102 |
+
"""
|
103 |
+
|
104 |
+
source_dataset, results = obtain_source_target_datasets()
|
105 |
+
pending_records = len(source_dataset)
|
106 |
+
|
107 |
+
# Assuming you have a DataFrame with user data, create a sample DataFrame
|
108 |
+
data = pd.DataFrame({"Category": ["Total remaining"], "Value": [pending_records]})
|
109 |
+
|
110 |
+
# Create Altair chart
|
111 |
+
chart = (
|
112 |
+
alt.Chart(data)
|
113 |
+
.mark_text(fontSize=100, align="center", baseline="middle", color="steelblue")
|
114 |
+
.encode(text="Value:N")
|
115 |
+
.properties(title="Total remaining", width=250, height=200)
|
116 |
+
)
|
117 |
+
|
118 |
+
return chart
|
119 |
|
120 |
def kpi_chart_submitted() -> alt.Chart:
|
121 |
"""
|
|
|
232 |
outputs=[plot],
|
233 |
)
|
234 |
|
235 |
+
plot = gr.Plot(label="Plot")
|
236 |
+
demo.load(
|
237 |
+
kpi_chart_remaining,
|
238 |
+
inputs=[],
|
239 |
+
outputs=[plot],
|
240 |
+
)
|
241 |
+
|
242 |
+
|
243 |
plot2 = gr.Plot(label="Plot")
|
244 |
demo.load(
|
245 |
+
donut_chart,
|
246 |
inputs=[],
|
247 |
outputs=[plot2],
|
248 |
)
|