import os import pandas as pd import requests def load_smithsonian_df( download_dir: str = "~/.objaverse_xl", ) -> pd.DataFrame: """Loads the Smithsonian Object Metadata dataset as a Pandas DataFrame. Args: download_dir (str, optional): Directory to download the parquet metadata file. Defaults to "~/.objaverse_xl". Returns: pd.DataFrame: Smithsonian Object Metadata dataset as a Pandas DataFrame with columns for the object "title", "url", "quality", and "file_type". The quality is always Medium and the file_type is always glb. """ dirname = os.path.expanduser(os.path.join(download_dir, "smithsonian")) os.makedirs(dirname, exist_ok=True) filename = os.path.join(dirname, "object-metadata.parquet") url = "https://huggingface.co/datasets/allenai/objaverse-xl/resolve/main/smithsonian/object-metadata.parquet" response = requests.get(url) response.raise_for_status() with open(filename, "wb") as file: file.write(response.content) return pd.read_parquet(filename)