Spaces:
Build error
Build error
Download utils/plot_utils.py from 3D-animation-arena/3D_Animation_Arena: direct link, hf CLI and curl.
- Browser
- Download file 1.41 kB
-
https://huggingface.co/spaces/3D-animation-arena/3D_Animation_Arena/resolve/main/utils/plot_utils.py
- Command line
-
hf download hf://spaces/3D-animation-arena/3D_Animation_Arena/utils/plot_utils.py
-
curl -L -o plot_utils.py https://huggingface.co/spaces/3D-animation-arena/3D_Animation_Arena/resolve/main/utils/plot_utils.py
1.41 kB
| import plotly.express as px | |
| from .data_utils import generate_data | |
| async def plot_ratings(criteria : str): | |
| """ | |
| Plot different ratings of the models for a given criteria on a line graph. | |
| Args: | |
| criteria (str): The criteria to plot the ratings for. | |
| """ | |
| data = await generate_data() | |
| elo_data = data[data['Criteria'] == criteria].reset_index(drop=True) | |
| elo_data.reset_index(inplace=True) | |
| elo_data['index'] = elo_data['index'].apply(lambda x: int(x/2)) | |
| elo_fig = px.line(elo_data, x='index', y='Elo', color='Model', title='Elo Ratings Over Total Votes', labels={'index': 'Total Votes', 'Elo': 'Elo Rating'}) | |
| wr_data = data[data['Criteria'] == criteria].reset_index(drop=True) | |
| wr_data.reset_index(inplace=True) | |
| wr_data['index'] = wr_data['index'].apply(lambda x: int(x/2)) | |
| wr_fig = px.line(wr_data, x='index', y='Win Rate', color='Model', title='Win Rates Over Total Votes', labels={'index': 'Total Votes', 'Win Rate': 'Win Rate'}) | |
| matches_data = data[data['Criteria'] == criteria].reset_index(drop=True) | |
| matches_data.reset_index(inplace=True) | |
| matches_data['index'] = matches_data['index'].apply(lambda x: int(x/2)) | |
| matches_fig = px.line(matches_data, x='index', y='Matches', color='Model', title='Matches Played Over Total Votes', labels={'index': 'Total Votes', 'Matches': 'Matches Played'}) | |
| return elo_fig, wr_fig, matches_fig |