Skip to content

Commit a418e37

Browse files
authored
Add Price Explorer Tab (#3663)
1 parent d161b64 commit a418e37

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

fastchat/serve/gradio_web_server_multi.py

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,31 +53,58 @@
5353
def build_visualizer():
5454
visualizer_markdown = """
5555
# 🔍 Arena Visualizer
56-
This tool provides an interactive way to explore how people are using Chatbot Arena.
57-
Using *[topic clustering](https://github.com/MaartenGr/BERTopic)*, we organized user-submitted prompts from Arena battles into broad and specific categories.
58-
Dive in to uncover insights about the distribution and themes of these prompts!
56+
Arena visualizer provides interactive tools to explore and draw insights from our leaderboard data.
5957
"""
6058
gr.Markdown(visualizer_markdown, elem_id="visualizer_markdown")
61-
expandText = "👇 Expand to see detailed instructions on how to use the visualizer"
62-
with gr.Accordion(expandText, open=False):
63-
instructions = """
64-
- Hover Over Segments: View the category name, the number of prompts, and their percentage.
65-
- *On mobile devices*: Tap instead of hover.
66-
- Click to Explore:
67-
- Click on a main category to see its subcategories.
68-
- Click on subcategories to see example prompts in the sidebar.
69-
- Undo and Reset: Click the center of the chart to return to the top level.
70-
71-
Visualizer is created using Arena battle data collected from 2024/6 to 2024/8.
72-
"""
73-
gr.Markdown(instructions)
74-
75-
frame = """
76-
<iframe class="visualizer" width="100%"
77-
src="https://storage.googleapis.com/public-arena-no-cors/index.html">
78-
</iframe>
59+
with gr.Tabs():
60+
with gr.Tab("Topic Explorer", id=0):
61+
topic_markdown = """
62+
This tool provides an interactive way to explore how people are using Chatbot Arena.
63+
Using *[topic clustering](https://github.com/MaartenGr/BERTopic)*, we organized user-submitted prompts from Arena battles into broad and specific categories.
64+
Dive in to uncover insights about the distribution and themes of these prompts! """
65+
gr.Markdown(topic_markdown)
66+
expandText = (
67+
"👇 Expand to see detailed instructions on how to use the visualizer"
68+
)
69+
with gr.Accordion(expandText, open=False):
70+
instructions = """
71+
- Hover Over Segments: View the category name, the number of prompts, and their percentage.
72+
- *On mobile devices*: Tap instead of hover.
73+
- Click to Explore:
74+
- Click on a main category to see its subcategories.
75+
- Click on subcategories to see example prompts in the sidebar.
76+
- Undo and Reset: Click the center of the chart to return to the top level.
77+
78+
Visualizer is created using Arena battle data collected from 2024/6 to 2024/8.
79+
"""
80+
gr.Markdown(instructions)
81+
82+
frame = """
83+
<iframe class="visualizer" width="100%"
84+
src="https://storage.googleapis.com/public-arena-no-cors/index.html">
85+
</iframe>
86+
"""
87+
gr.HTML(frame)
88+
with gr.Tab("Price Explorer", id=1):
89+
price_markdown = """
90+
This scatterplot presents a selection of models from the Arena, plotting their score against their cost. Only models with publicly available pricing and parameter information are included, meaning models like Gemini's experimental models are not displayed. Feel free to view price sources or add pricing information [here](https://github.com/lmarena/arena-catalog/blob/main/data/scatterplot-data.json).
7991
"""
80-
gr.HTML(frame)
92+
gr.Markdown(price_markdown)
93+
expandText = (
94+
"👇 Expand to see detailed instructions on how to use the scatterplot"
95+
)
96+
with gr.Accordion(expandText, open=False):
97+
instructions = """
98+
- Hover Over Points: View the model's arena score, cost, organization, and license.
99+
- Click on Points: Click on a point to visit the model's website.
100+
- Use the Legend: Click an organization name on the right to display its models. To compare models, click multiple organization names.
101+
- Select Category: Use the dropdown menu in the upper-right corner to select a category and view the arena scores for that category.
102+
"""
103+
gr.Markdown(instructions)
104+
105+
frame = """<object type="text/html" data="https://storage.googleapis.com/public-arena-no-cors/scatterplot.html" width="100%" class="visualizer"></object>"""
106+
107+
gr.HTML(frame)
81108

82109

83110
def load_demo(context: Context, request: gr.Request):

0 commit comments

Comments
 (0)