dvilasuero HF staff commited on
Commit
dc57185
β€’
1 Parent(s): 3d2851f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -42
app.py CHANGED
@@ -62,46 +62,6 @@ def get_user_annotations_dictionary(
62
 
63
  return output
64
 
65
-
66
- def donut_chart2() -> alt.Chart:
67
- # Load your data
68
- source_dataset, results = obtain_source_target_datasets()
69
- pending_records = len(source_dataset)
70
- annotated_records = len(results)
71
-
72
- # Prepare data for the donut chart
73
- source = pd.DataFrame({
74
- "values": [annotated_records, pending_records],
75
- "category": ["Completed", "Remaining"],
76
- "colors": ["#4CAF50", "#757575"] # Green for Completed, Grey for Remaining
77
- })
78
-
79
- # Base chart for donut segments
80
- base = alt.Chart(source).encode(
81
- theta=alt.Theta(field="values", type="quantitative", stack=True), # The angle encoding
82
- color=alt.Color(field="colors", type="nominal", legend=None), # Direct color specification
83
- tooltip=['category', 'values'] # Tooltips for interactivity
84
- )
85
-
86
- # Arc marks for donut segments
87
- arcs = base.mark_arc(innerRadius=100, outerRadius=150, stroke="#fff") # Increased inner radius for a thicker donut
88
-
89
- # Combine the arcs
90
- chart = arcs.properties(
91
- # Set the size of the chart
92
- width=400,
93
- height=400
94
- )
95
-
96
- # Configure the view to have a transparent background
97
- chart = chart.configure_view(
98
- strokeWidth=0, # Remove border around chart
99
- fill=None # Ensure background is transparent
100
- )
101
-
102
- return chart
103
-
104
-
105
  def donut_chart() -> alt.Chart:
106
  # Load your data
107
  source_dataset, results = obtain_source_target_datasets()
@@ -195,7 +155,7 @@ def main() -> None:
195
 
196
  annotated = len(target_dataset)
197
  remaining = int(os.getenv("TARGET_RECORDS")) - annotated
198
- percentage_completed = (annotated / int(os.getenv("TARGET_RECORDS"))) * 100
199
 
200
 
201
  with gr.Blocks() as demo:
@@ -210,7 +170,8 @@ def main() -> None:
210
  gr.Markdown(
211
  f"""
212
  ## πŸš€ Contributors Progress
213
- **{annotated}** responses have been completed **({percentage_completed})**, there remains **{remaining}** responses to reach the target.
 
214
  """
215
  )
216
  plot = gr.Plot(label="Plot")
 
62
 
63
  return output
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  def donut_chart() -> alt.Chart:
66
  # Load your data
67
  source_dataset, results = obtain_source_target_datasets()
 
155
 
156
  annotated = len(target_dataset)
157
  remaining = int(os.getenv("TARGET_RECORDS")) - annotated
158
+ percentage_completed = round((annotated / int(os.getenv("TARGET_RECORDS"))) * 100,1)
159
 
160
 
161
  with gr.Blocks() as demo:
 
170
  gr.Markdown(
171
  f"""
172
  ## πŸš€ Contributors Progress
173
+ ### Completed: **{annotated}** (**({percentage_completed})**)
174
+ ### Remaining: **{remaining}**
175
  """
176
  )
177
  plot = gr.Plot(label="Plot")