yifanzhang114's picture
Reinitializing and uploading files to Hugging Face repository
70ee7ff
|
raw
history blame
831 Bytes

MME-RealWorld Dataset

This dataset contains multiple JSON files split into chunks. It includes information such as questions, images encoded in base64, and other related metadata.

Usage

You can load the dataset using the datasets library:

from datasets import load_dataset

dataset = load_dataset('yifanzhang114/MME-RealWorld-Base64', data_dir='MME-RealWorld')
dataset = load_dataset('yifanzhang114/MME-RealWorld-Base64', data_dir='MME-RealWorld-CN')

## the image can be decoded by 

def decode_base64_to_image(base64_string, target_size=-1):
    image_data = base64.b64decode(base64_string)
    image = Image.open(io.BytesIO(image_data))
    if image.mode in ('RGBA', 'P'):
        image = image.convert('RGB')
    if target_size > 0:
        image.thumbnail((target_size, target_size))
    return image