AITextDetector / examples /simple_download.py
ChauHPham's picture
Upload folder using huggingface_hub
25faba3 verified
raw
history blame contribute delete
856 Bytes
"""
Simple example: Download dataset directly in your code
Just copy-paste this into your script!
"""
import kagglehub
import pandas as pd
from pathlib import Path
# Download dataset (no API token needed!)
print("πŸ“₯ Downloading dataset...")
path = kagglehub.dataset_download("shamimhasan8/ai-vs-human-text-dataset")
print(f"βœ… Downloaded to: {path}")
# Find and load CSV
csv_files = list(Path(path).glob("*.csv"))
if csv_files:
df = pd.read_csv(csv_files[0])
print(f"βœ… Loaded {len(df):,} rows")
print(f" Columns: {list(df.columns)}")
# Save to your data directory
output_path = "data/dataset.csv"
df.to_csv(output_path, index=False)
print(f"πŸ’Ύ Saved to: {output_path}")
# Now you can use it!
print(f"\n🎯 Use this path in your config: {output_path}")
else:
print("⚠️ No CSV files found")