lambdaofgod commited on
Commit
a06639e
·
1 Parent(s): ea60d34

feat: Replace `update_button` with a gradio.Interface in the "Explore PapersWithCode Tasks" tab

Browse files
Files changed (1) hide show
  1. app.py +17 -18
app.py CHANGED
@@ -111,24 +111,23 @@ with gr.Blocks() as demo:
111
  setup_repository_representations_tab(repos, representation_types)
112
  with gr.Tab("Explore PapersWithCode Tasks"):
113
  gr.Markdown("## PapersWithCode Tasks Visualization")
114
- with gr.Row():
115
- min_task_count = gr.Slider(
116
- minimum=1, maximum=100, value=10, step=1, label="Minimum Task Count"
117
- )
118
- update_button = gr.Button("Update Plots")
119
-
120
- with gr.Row():
121
- with gr.Column():
122
- gr.Markdown("### All Repositories")
123
- all_repos_plot = gr.Plot()
124
- with gr.Column():
125
- gr.Markdown("### Selected Repositories")
126
- selected_repos_plot = gr.Plot()
127
-
128
- update_button.click(
129
- fn=task_visualizations.display_tasks_sunburst_charts,
130
- inputs=[min_task_count],
131
- outputs=[all_repos_plot, selected_repos_plot],
132
  )
133
 
134
  demo.launch()
 
111
  setup_repository_representations_tab(repos, representation_types)
112
  with gr.Tab("Explore PapersWithCode Tasks"):
113
  gr.Markdown("## PapersWithCode Tasks Visualization")
114
+
115
+ def update_plots(min_count):
116
+ all_plot, selected_plot = task_visualizations.display_tasks_sunburst_charts(min_count)
117
+ return [all_plot, selected_plot]
118
+
119
+ interface = gr.Interface(
120
+ fn=update_plots,
121
+ inputs=[
122
+ gr.Slider(minimum=1, maximum=100, value=10, step=1, label="Minimum Task Count")
123
+ ],
124
+ outputs=[
125
+ gr.Plot(label="All Repositories"),
126
+ gr.Plot(label="Selected Repositories")
127
+ ],
128
+ live=True,
129
+ title="PapersWithCode Tasks Visualization",
130
+ description="Adjust the minimum task count to update the sunburst charts."
 
131
  )
132
 
133
  demo.launch()