lambdaofgod commited on
Commit
15420a6
·
1 Parent(s): 3af9af7

feat: Add separate sliders for all and selected repositories in the PapersWithCode tasks tab

Browse files
Files changed (2) hide show
  1. app.py +10 -3
  2. task_visualizations.py +15 -9
app.py CHANGED
@@ -119,12 +119,19 @@ with gr.Blocks() as demo:
119
  gr.Markdown(task_counts_description)
120
 
121
  with gr.Row():
122
- min_task_counts_slider = gr.Slider(
123
  minimum=10,
124
  maximum=1000,
125
  value=100,
126
  step=10,
127
- label="Minimum Task Count",
 
 
 
 
 
 
 
128
  )
129
  update_button = gr.Button("Update Plots")
130
 
@@ -134,7 +141,7 @@ with gr.Blocks() as demo:
134
 
135
  update_button.click(
136
  fn=task_visualizations.get_tasks_sunbursts,
137
- inputs=[min_task_counts_slider],
138
  outputs=[all_repos_tasks_plot, selected_repos_tasks_plot],
139
  )
140
 
 
119
  gr.Markdown(task_counts_description)
120
 
121
  with gr.Row():
122
+ min_task_counts_slider_all = gr.Slider(
123
  minimum=10,
124
  maximum=1000,
125
  value=100,
126
  step=10,
127
+ label="Minimum Task Count (All Repositories)",
128
+ )
129
+ min_task_counts_slider_selected = gr.Slider(
130
+ minimum=10,
131
+ maximum=1000,
132
+ value=100,
133
+ step=10,
134
+ label="Minimum Task Count (Selected Repositories)",
135
  )
136
  update_button = gr.Button("Update Plots")
137
 
 
141
 
142
  update_button.click(
143
  fn=task_visualizations.get_tasks_sunbursts,
144
+ inputs=[min_task_counts_slider_all, min_task_counts_slider_selected],
145
  outputs=[all_repos_tasks_plot, selected_repos_tasks_plot],
146
  )
147
 
task_visualizations.py CHANGED
@@ -57,16 +57,22 @@ class TaskVisualizations:
57
  )
58
  return displayed_tasks_with_areas_df
59
 
60
- def get_tasks_sunburst(self, min_task_count, which_df="selected"):
61
- if which_df == "selected":
62
- df = self.selected_tasks_with_areas_df
63
- else:
64
- df = self.tasks_with_areas_df
65
 
66
- displayed_tasks_with_areas_df = self.get_displayed_tasks_with_areas_df(
67
- df, min_task_count
 
 
 
68
  )
69
 
70
- return px.sunburst(
71
- displayed_tasks_with_areas_df, path=["area", "task"], values="count"
 
 
 
72
  )
 
 
 
57
  )
58
  return displayed_tasks_with_areas_df
59
 
60
+ def get_tasks_sunbursts(self, min_task_count_all, min_task_count_selected):
61
+ all_df = self.tasks_with_areas_df
62
+ selected_df = self.selected_tasks_with_areas_df
 
 
63
 
64
+ displayed_tasks_all_df = self.get_displayed_tasks_with_areas_df(
65
+ all_df, min_task_count_all
66
+ )
67
+ displayed_tasks_selected_df = self.get_displayed_tasks_with_areas_df(
68
+ selected_df, min_task_count_selected
69
  )
70
 
71
+ all_sunburst = px.sunburst(
72
+ displayed_tasks_all_df, path=["area", "task"], values="count"
73
+ )
74
+ selected_sunburst = px.sunburst(
75
+ displayed_tasks_selected_df, path=["area", "task"], values="count"
76
  )
77
+
78
+ return all_sunburst, selected_sunburst