|
38 | 38 | load_demo_single, |
39 | 39 | get_ip, |
40 | 40 | ) |
41 | | -from fastchat.serve.monitor.monitor import build_leaderboard_tab |
| 41 | +from fastchat.serve.monitor.monitor import ( |
| 42 | + build_leaderboard_tab, |
| 43 | + build_prompt_to_leaderboard_tab, |
| 44 | +) |
42 | 45 | from fastchat.utils import ( |
43 | 46 | build_logger, |
44 | 47 | get_window_url_params_js, |
@@ -252,11 +255,17 @@ def build_demo( |
252 | 255 | arena_hard_table, |
253 | 256 | show_plot=True, |
254 | 257 | ) |
| 258 | + if args.prompt_to_leaderboard_examples: |
| 259 | + with gr.Tab("🏆 Prompt-to-Leaderboard", id=4): |
| 260 | + build_prompt_to_leaderboard_tab( |
| 261 | + leaderboard_table_file, |
| 262 | + args.prompt_to_leaderboard_examples, |
| 263 | + ) |
255 | 264 | if args.show_visualizer: |
256 | | - with gr.Tab("🔍 Arena Visualizer", id=5): |
| 265 | + with gr.Tab("🔍 Arena Visualizer", id=6): |
257 | 266 | build_visualizer() |
258 | 267 |
|
259 | | - with gr.Tab("ℹ️ About Us", id=4): |
| 268 | + with gr.Tab("ℹ️ About Us", id=5): |
260 | 269 | build_about() |
261 | 270 |
|
262 | 271 | context_state = gr.State(context) |
@@ -368,6 +377,12 @@ def build_demo( |
368 | 377 | default=False, |
369 | 378 | help="Show the Data Visualizer tab", |
370 | 379 | ) |
| 380 | + parser.add_argument( |
| 381 | + "--prompt-to-leaderboard-examples", |
| 382 | + type=str, |
| 383 | + default=None, |
| 384 | + help="Point to the file where Prompt-to-Leaderboard examples are stored, also enable its tab", |
| 385 | + ) |
371 | 386 | args = parser.parse_args() |
372 | 387 | logger.info(f"args: {args}") |
373 | 388 |
|
|
0 commit comments