Datasets:

Modalities:
Image
Text
Formats:
parquet
ArXiv:
Libraries:
Datasets
Dask
nmb-plus-clean / README.md
shainaraza's picture
Update README.md
bc47bd0 verified
|
raw
history blame
1 kB
from datasets import load_dataset
from IPython.display import display, HTML

# Load the dataset
ds = load_dataset("vector-institute/newsmediabias-plus-clean")

# Shuffle the dataset and select 50 random records
random_records = ds['train'].shuffle(seed=42).select(range(50))  # Adjust 'train' if needed

# Display the first few records (e.g., article text and image if available)
for i, record in enumerate(random_records):
    article_text = ' '.join(record['article_text'].split()[:200])  # First 200 words of the article
    display(HTML(f"<h3>Record {i+1}</h3><p>{article_text}</p>"))
    
    # Display image if available
    image_data = record.get('image', None)
    if image_data:
        try:
            display(image_data)
        except Exception as e:
            print(f"Error displaying image for record {i+1}: {e}")
    else:
        print(f"No image available for record {i+1}.")

Citation If you use this work, please cite the following: https://arxiv.org/pdf/2412.17052