{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# {{ project_name }} - General Base\n",
"\n",
"**Author:** {{ author_name }}\n",
"**Description:** {{ description }}\n",
"\n",
"This notebook demonstrates the **Smart Data Loader** capabilities.\n",
"\n",
"It supports two modes:\n",
"1. **Global Cache (Default)**: Downloads to `~/.cache/viperx/data`. Ideal for shared datasets.\n",
"2. **Local Project (Optional)**: Downloads to `./data`. Ideal for project-specific datasets."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Universal Setup\n",
"import sys\n",
"from {{ package_name }} import get_config\n",
"from {{ package_name }}.data_loader import load_csv, download_file\n",
"\n",
"print(f\"Project: {get_config('project_name')}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Standard Imports\n",
"import numpy as np\n",
"import pandas as pd\n",
"import matplotlib.pyplot as plt\n",
"import seaborn as sns\n",
"\n",
"{% if project_type == 'dl' %}\n",
"{% if framework == 'pytorch' %}\n",
"import torch\n",
"print(f\"PyTorch Version: {torch.__version__}\")\n",
"{% elif framework == 'tensorflow' %}\n",
"import tensorflow as tf\n",
"print(f\"TensorFlow Version: {tf.__version__}\")\n",
"{% endif %}\n",
"{% endif %}\n",
"\n",
"%matplotlib inline"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Mode 1: Global Cache (Default)\n",
"# Does NOT create a 'data/' folder in your project.\n",
"# Uses config.yaml key 'iris'\n",
"\n",
"try:\n",
" print(\"Loading Iris (Global Cache)...\")\n",
" df_iris = load_csv('iris')\n",
" display(df_iris.head())\n",
"except Exception as e:\n",
" print(f\"Error: {e}\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Mode 2: Local Project Data\n",
"# Forces download to ./data/ folder\n",
"# Uses config.yaml key 'titanic'\n",
"\n",
"try:\n",
" print(\"Loading Titanic (Local Download)...\")\n",
" # Passing local=True triggers ./data creation\n",
" df_titanic = load_csv('titanic', local=True)\n",
" display(df_titanic.head())\n",
" \n",
" print(\"\\nCheck your project root: 'data/' folder should now exist!\")\n",
"except Exception as e:\n",
" print(f\"Error: {e}\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}