The dataset is currently empty. Upload or create new data files. Then, you will be able to explore them in the Dataset Viewer.
from datasets import Dataset, DatasetDict, Features, Value, ClassLabel import pandas as pd
1. Подготовка данных
train_df = pd.DataFrame({ 'text': ['Отличный продукт!', 'Ужасное качество', 'Нормально'], 'label': [1, 0, 1] })
test_df = pd.DataFrame({ 'text': ['Рекомендую', 'Не советую'], 'label': [1, 0] })
2. Определение схемы (опционально)
features = Features({ 'text': Value('string'), 'label': ClassLabel(names=['negative', 'positive']) })
3. Создание датасетов
train_dataset = Dataset.from_pandas(train_df, features=features) test_dataset = Dataset.from_pandas(test_df, features=features)
4. Создание DatasetDict
dataset = DatasetDict({ 'train': train_dataset, 'test': test_dataset })
5. Загрузка на Hub
dataset.push_to_hub( "your-username/my-sentiment-dataset", private=False # или True для приватного датасета )
print("✅ Датасет успешно создан!")
- Downloads last month
- 5