nxphi47 commited on
Commit
1fdfeae
1 Parent(s): c97b702

Update performance_plot.py

Browse files
Files changed (1) hide show
  1. performance_plot.py +11 -5
performance_plot.py CHANGED
@@ -237,15 +237,21 @@ def plot_by_lang_fn():
237
  return fig
238
 
239
 
 
 
240
 
241
- def attach_plot_to_demo(demo):
242
- with gr.Accordion("Psst... wanna see some performance benchmarks?", open=False):
 
 
 
 
243
  gr_plot_agg = gr.Plot(label="Aggregated")
244
  gr_plot_bylang = gr.Plot(label='By language')
245
 
246
  # def callback():
247
- demo.load(plot_agg_fn, [], gr_plot_agg)
248
- demo.load(plot_by_lang_fn, [], gr_plot_bylang)
249
- # return callback
250
 
251
 
 
237
  return fig
238
 
239
 
240
+ def both_plot():
241
+ return plot_agg_fn(), plot_by_lang_fn()
242
 
243
+
244
+ def attach_plot_to_demo(demo: gr.Blocks):
245
+ with gr.Accordion("Psst... wanna see some performance benchmarks?", open=False) as accord:
246
+ # gr_plot_agg = gr.Plot(plot_agg_fn, label="Aggregated")
247
+ # gr_plot_bylang = gr.Plot(plot_by_lang_fn, label='By language')
248
+ show_result = gr.Button("Load benchmark results")
249
  gr_plot_agg = gr.Plot(label="Aggregated")
250
  gr_plot_bylang = gr.Plot(label='By language')
251
 
252
  # def callback():
253
+ # demo.load(plot_agg_fn, [], gr_plot_agg)
254
+ # demo.load(plot_by_lang_fn, [], gr_plot_bylang)
255
+ show_result.click(both_plot, [], [gr_plot_agg, gr_plot_bylang])
256
 
257