import fiftyone as fo from io import BytesIO from PIL import Image from datasets import load_dataset import os # Load the dataset imagenet_hard_dataset = load_dataset("taesiri/imagenet-hard", split="validation") os.makedirs("dataset", exist_ok=True) list_of_images = [] for i in range(len(imagenet_hard_dataset)): image = imagenet_hard_dataset[i]["image"].convert("RGB") image.save(f"dataset/{i}.JPEG", "JPEG", quality=100) list_of_images.append(f"imagenet_hard_images/{i}.jpg") if __name__ == "__main__": # Ensures that the App processes are safely launched on Windows dataset = fo.Dataset.from_images_dir("./dataset/") session = fo.launch_app(dataset, port=7860, remote=True, address="0.0.0.0") session.wait()