import requests import json from typing import List import numpy as np import matplotlib.pyplot as plt from matplotlib.axes import Axes from pydantic import BaseModel from adjustText import adjust_text results_url = 'https://tempory.net/f/memobin/benchcompress/global/results.json' class BenchmarkResult(BaseModel): compression_ratio: float encode_time: float decode_time: float encode_mb_per_sec: float decode_mb_per_sec: float original_size: int compressed_size: int array_shape: List[int] array_dtype: str timestamp: float cache_status: str dataset: str algorithm: str algorithm_version: str dataset_version: str system_version: str class BenchmarkResults(BaseModel): results: List[BenchmarkResult] def download_results() -> dict: url = results_url print(f"Downloading results from {url}...") response = requests.get(url) response.raise_for_status() return response.json() def load_results_into_models(data: dict) -> BenchmarkResults: """Load the downloaded data into pydantic models.""" return BenchmarkResults(**data)