code: def df_from_shelve(chunk_size, func, dataset_name):
      print("Generating Dataframe from results...")
      with shelve.open(
          "%s_%s_%s_results.tmp"
          % (dataset_name, func.__name__, chunk_size)
      ) as results:
          keylist = sorted([int(k) for k in results.keys()])
          df = pd.concat(
              [results[str(k)][1] for k in keylist], sort=True
          )
      return df
  
imports: import glob
  from pathlib import Path
  import time
  from omegaconf import OmegaConf
  import pandas
  import numpy
  import requests
  import zlib
  import os
  import io
  import shelve
  from lavis.common.utils import get_abs_path, get_cache_path
  import magic
  import json
  from multiprocessing import Pool
  from tqdm import tqdm
  from PIL import Image
  from torchvision.transforms import functional
label_desc: Use image node_id 9 for calling a global function with example usage: df_from_shelve(chunk_size, func, dataset_name) and returns: df