Skip to content

Add /examples directory for API documentation and Model usage #1442

@trivedikavya

Description

@trivedikavya

Is your feature request related to a problem or challenge?

Currently, the repository lacks a dedicated examples/ directory. While the codebase is structured, new users and contributors must dive deep into the source code or local server setup to understand how to interact with the ML models and API endpoints.

Adding an examples/ folder will provide a "quick-start" layer, allowing developers to test functionality in isolation (via notebooks or scripts) before full integration.

Describe the solution you'd like

I suggest a structure that covers the three main pillars of the project: Data, ML Exploration, and API Integration.
examples/
├── data/
│ ├── sample_crop_input.json # Mock data for Crop Recommendation (single/batch)
│ ├── sample_yield_input.json # Mock data for Yield Prediction
│ └── sample_soil_data.csv # Dataset for N/P/K and pH testing
├── notebooks/
│ ├── crop_recommendation.ipynb # Step-by-step model inference & visualization
│ ├── yield_prediction.ipynb # Model comparison and yield charts
│ └── disease_detection.ipynb # CNN walkthrough for leaf image processing
├── scripts/
│ ├── api_usage_demo.py # Python implementation (requests library)
│ ├── fetch_api.js # JavaScript/Node.js implementation
│ └── test_suite.py # Pytest/Unittest suite for endpoint validation
└── README.md # Documentation for running examples

Why This Is Needed

  • Lower Barrier to Entry: New contributors can understand the expected Input/Output shapes of the models without running the entire Flask/Django backend.
  • Frontend/Backend Decoupling: Providing fetch and python-request examples allows frontend developers to build UI components using guaranteed-correct API call structures.
  • Data Validation: Sample .csv and .json files serve as a "Source of Truth" for what the models expect, reducing debugging time for data-type errors.
  • Testing & Stability: An automated test script in the examples folder allows contributors to quickly verify that their local changes haven't broken the core API logic.

Additional context

Requirements

To make this effective, the examples should include:

  • Realistic Indian agricultural data (N/P/K values, climate data).
  • Comprehensive docstrings and error-handling logic in scripts.
  • Visualizations (Matplotlib/Seaborn) in notebooks to show model confidence.

@omroy07 sir can You please Assigne Me this Issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions