code: def test_write_from_directory(orca_context_fixture, use_api=False):
      sc = orca_context_fixture
      temp_dir = tempfile.mkdtemp()
      try:
          label_map = {"cats": 0, "dogs": 1}
          if use_api:
              write_parquet(
                  "image_folder",
                  "file://" + temp_dir,
                  directory=os.path.join(resource_path, "cat_dog"),
                  label_map=label_map,
              )
          else:
              write_from_directory(
                  os.path.join(resource_path, "cat_dog"),
                  label_map,
                  "file://" + temp_dir,
              )
          train_xshard = ParquetDataset._read_as_xshards(
              "file://" + temp_dir
          )
  
          data = train_xshard.collect()[0]
          image_path = data["image_id"][0]
  
          with open(image_path, "rb") as f:
              image_bytes = f.read()
  
          assert image_bytes == data["image"][0]
  
      finally:
          shutil.rmtree(temp_dir)
  
file_path: BigDL/python/orca/test/bigdl/orca/data/test_write_parquet.py
imports: import tempfile
  import shutil
  import pytest
  import numpy
  import os
  from bigdl.orca.data.image.parquet_dataset import ParquetDataset
  from bigdl.orca.data.image.parquet_dataset import write_from_directory, write_parquet
  from bigdl.orca.data.image.utils import DType, FeatureType, SchemaField
  from bigdl.orca.data.image import write_mnist, write_voc
label_desc: Use image node_id 7 for calling a global function with example usage: test_write_from_directory(orca_context_fixture, use_api) without return types