CoolFace
Apppublic

SebasLopez-ai/cifar-10-classifier

sourceHugging Facemitupdated 7mo agoView on Hugging Face
0likes
1In software development and data science, creating a src (short for source) folder is a widespread best practice for organizing a project.2 3Looking at your current CIFAR-10 image classification project, here is why you and most developers put core Python files (like 4 5data_loader.py6, 7 8model_builder.py9, etc.) into a src/ directory:10 111. Separation of Concerns12A real-world project has many different types of files:13 14Documentation: 15 16README.md17, 18 19REPORT.md20Environment settings: 21 22requirements.txt23, 24 25.gitignore26Exploration & Presentation: Jupyter Notebooks (in your notebooks_knowledge&presentation/ folder)27User Interface/App: Streamlit or Flask code (in your app/ folder)28The Core Logic: The actual python scripts that do the heavy lifting.29By placing the core logic inside the src/ folder, you perfectly separate the "engine" of your project from the documentation, the UI, and the configuration.30 312. Modularity and Reusability (Easy Importing)32By having a src/ folder (with an init.py file inside), Python treats it as a module. This means you can easily reuse the exact same code in different places without copying and pasting.33 34For example, whether you are experimenting in a Jupyter Notebook or running your web interface in 35 36app/app.py37, you can effortlessly use your data loader like this:38 39python40from src.data_loader import load_data41from src.model_builder import build_model42This is much cleaner than defining standard functions repeatedly in different notebooks.43 443. A Clean Root Directory45Without a src/ folder, your root project directory would be flooded with python files: 46 47train.py48, 49 50evaluate.py51, 52 53data_loader.py54, app.py, mixed alongside 55 56requirements.txt57 and .git. By storing them in src/, your root directory stays clean and easy to read for any other developer (or yourself in the future) who lands on your project's GitHub page.58 594. Preventing Import Conflicts (The src Layout)60In standard Python packaging, using a src layout forces you to test your code exactly how it will be imported by others. It prevents accidental import errors that can happen when your application code is sitting right next to your top-level scripts.61 62Summary: 63 64You create src/ to house the core "engine" of your machine learning workflow (loading data, building models, training, evaluating), allowing you to easily import those functions into both your Jupyter Notebooks and your app.py while keeping your workspace organized!65 66