|
import streamlit as st |
|
import pandas as pd |
|
import plotly.express as px |
|
|
|
|
|
st.set_page_config( |
|
page_title="Max Output Tokens Analysis", |
|
layout="wide" |
|
) |
|
|
|
|
|
st.markdown(""" |
|
<style> |
|
.stMultiSelect { |
|
max-width: 800px; |
|
} |
|
.main > div { |
|
padding-left: 1rem; |
|
padding-right: 1rem; |
|
} |
|
</style> |
|
""", unsafe_allow_html=True) |
|
|
|
|
|
@st.cache_data |
|
def load_data(): |
|
df = pd.read_csv('data/max-tokens-by-model.csv') |
|
df['launch_date'] = pd.to_datetime(df['launch_date']) |
|
return df |
|
|
|
df = load_data() |
|
|
|
|
|
st.title("LLM Max Output Tokens Analysis") |
|
|
|
|
|
col1, col2 = st.columns([2, 1]) |
|
with col1: |
|
companies = sorted(df['company'].unique()) |
|
selected_companies = st.multiselect( |
|
"Select companies to display:", |
|
options=companies, |
|
default=companies, |
|
key='company_filter' |
|
) |
|
|
|
|
|
filtered_df = df[df['company'].isin(selected_companies)] |
|
|
|
|
|
fig = px.line(filtered_df, |
|
x='launch_date', |
|
y='max_output_tokens', |
|
color='company', |
|
hover_data=['model_name', 'max_output_tokens'], |
|
title='Evolution of Max Output Tokens by Company', |
|
labels={ |
|
'launch_date': 'Launch Date', |
|
'max_output_tokens': 'Max Output Tokens', |
|
'company': 'Company' |
|
}, |
|
markers=True) |
|
|
|
|
|
fig.update_layout( |
|
hovermode='x unified', |
|
xaxis_title="Launch Date", |
|
yaxis_title="Max Output Tokens", |
|
yaxis_type="log", |
|
height=500, |
|
showlegend=True, |
|
legend=dict( |
|
orientation="h", |
|
yanchor="bottom", |
|
y=1.02, |
|
xanchor="right", |
|
x=1 |
|
), |
|
margin=dict(l=40, r=40, t=60, b=40), |
|
yaxis=dict( |
|
tickformat=",", |
|
dtick=0.30102999566, |
|
), |
|
plot_bgcolor='white', |
|
paper_bgcolor='white', |
|
) |
|
|
|
|
|
fig.update_xaxes( |
|
gridcolor='lightgray', |
|
gridwidth=0.5, |
|
showgrid=True |
|
) |
|
fig.update_yaxes( |
|
gridcolor='lightgray', |
|
gridwidth=0.5, |
|
showgrid=True |
|
) |
|
|
|
fig.update_traces( |
|
line=dict(width=2), |
|
marker=dict(size=8) |
|
) |
|
|
|
|
|
st.plotly_chart(fig, use_container_width=True) |
|
|
|
|
|
st.subheader("Max Output Tokens by Model") |
|
|
|
|
|
display_df = ( |
|
filtered_df[['model_name', 'company', 'max_output_tokens', 'launch_date']] |
|
.sort_values('max_output_tokens', ascending=False) |
|
.assign( |
|
launch_date=lambda x: x['launch_date'].dt.strftime('%Y-%m-%d'), |
|
max_output_tokens=lambda x: x['max_output_tokens'].apply(lambda v: f"{v:,}") |
|
) |
|
.rename(columns={ |
|
'model_name': 'Model Name', |
|
'company': 'Company', |
|
'max_output_tokens': 'Max Output Tokens', |
|
'launch_date': 'Launch Date' |
|
}) |
|
) |
|
|
|
|
|
st.dataframe( |
|
display_df, |
|
use_container_width=True, |
|
hide_index=True |
|
) |
|
|
|
|
|
st.markdown("<br>", unsafe_allow_html=True) |
|
st.markdown( |
|
"<div style='border-top: 1px solid #ccc; padding-top: 1rem; color: #666;'>" |
|
"By: <a href='https://danielrosehill.com' style='color: #666;'>Daniel Rosehill</a> | " |
|
"Data sourced from public sources on February 8, 2025" |
|
"</div>", |
|
unsafe_allow_html=True |
|
) |
|
|