✦ New Age Learning 🔍
Home › Library › AI for New Learner- Senior 2 › Capstone Build-It Projects

📖 Chapter 9 of 13 · AI for New Learner- Senior 2 · Class 10

Capstone Build-It Projects

Three real builds. Ship at least one before your final exam. Each takes 4-8 hours over a weekend: real Python, real datasets, a trained model, a proper evaluation, AND a deployment. Finish ONE and you have done more practical AI than 90% of Indian college freshers — ending with working code, a .pkl model, a model card, a deployed URL, and a GitHub repo for your CV.

Capstone 1 — House Price Predictor (Linear Regression)

Predict the price of a Bengaluru house from its size (sqft), bathrooms, and BHK, using the real Kaggle Bengaluru House Price dataset. Build an interactive Streamlit app where anyone can enter requirements and see a predicted price.

💻 CODE LAB train.py — train and save the model

import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import r2_score, mean_squared_error
import joblib

df = pd.read_csv('bengaluru.csv').dropna()
df = df[['total_sqft', 'bath', 'bhk', 'price']]     # 4 features

X = df.drop('price', axis=1)
y = df['price']
Xtr, Xts, ytr, yts = train_test_split(X, y, test_size=0.2)

model = LinearRegression()
model.fit(Xtr, ytr)

print('R2:', r2_score(yts, model.predict(Xts)))
print('RMSE:', mean_squared_error(yts, model.predict(Xts))**0.5)

joblib.dump(model, 'house_model.pkl')     # SAVE for deployment

💻 CODE LAB app.py — the deployed predictor

import streamlit as st
import joblib

model = joblib.load('house_model.pkl')

st.title('Bengaluru House Price Predictor')
st.caption('Built with sklearn. Trained on real Kaggle data.')

sqft = st.number_input('Total sqft', 300, 10000, 1200)
bath = st.slider('Bathrooms', 1, 6, 2)
bhk = st.slider('BHK', 1, 6, 2)

if st.button('Predict Price'):
    pred = model.predict([[sqft, bath, bhk]])[0]
    st.success('Estimated price: Rs ' + str(round(pred, 1)) + ' lakh')
    st.caption('Note: an estimate, not financial advice.')

Capstone 2 — Plant Disease Classifier (Random Forest)

Given simple leaf measurements (colour stats, spot count, area), classify a leaf as Healthy / Early Blight / Late Blight / Bacterial Spot using a Random Forest — the explainable model Niramai-style teams use. Dataset: the PlantVillage collection on Kaggle.

💻 CODE LAB train.py — random forest classifier

import pandas as pd
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import classification_report
import joblib

df = pd.read_csv('plant_features.csv')     # extracted features
X = df.drop('disease', axis=1)
y = df['disease']

Xtr, Xts, ytr, yts = train_test_split(X, y, test_size=0.2,
    stratify=y, random_state=42)

model = RandomForestClassifier(n_estimators=100, random_state=42)
model.fit(Xtr, ytr)

print(classification_report(yts, model.predict(Xts)))
joblib.dump(model, 'plant_model.pkl')

⚙ TRY IT TODAY

Bonus: replace the manual sliders with an actual image upload using st.file_uploader. Use OpenCV to extract greenness and spot count automatically. This is exactly what Krish did in Chapter 5.

Capstone 3 — Sentiment Analyser, deployed (NLP)

Given a sentence in Hindi or English, predict its sentiment (Positive / Negative / Neutral) using a pre-trained transformer from Hugging Face — no need to train from scratch. Deploy on HF Spaces, and your URL will look just like Sarvam’s.

💻 CODE LAB app.py — uses a Hugging Face model directly

import streamlit as st
from transformers import pipeline

@st.cache_resource
def load_model():
    # A tiny multilingual model that supports Hindi + English
    return pipeline('sentiment-analysis',
        model='cardiffnlp/twitter-xlm-roberta-base-sentiment')

classifier = load_model()

st.title('Sentiment Analyser - Hindi/English')
text = st.text_area('Enter your sentence:', 'I love mango lassi!')

if st.button('Analyse'):
    result = classifier(text)[0]
    st.metric('Sentiment', result['label'],
        str(round(result['score']*100, 1)) + '% confident')

What each capstone gives you

Working code you can show to anyone · a trained model file (.pkl) · a model card (markdown) · a deployed URL like yourapp.streamlit.app · and a GitHub repo to put on your CV.

All chapters in AI for New Learner- Senior 2

  1. Chapter 1: Where You Are Now — The ML Lifecycle
  2. Chapter 2: From Idea to Dataset
  3. Chapter 3: Linear Models — The Workhorses
  4. Chapter 4: Decision Trees & Random Forests
  5. Chapter 5: Neural Networks Demystified
  6. Chapter 6: Evaluation — Does It Actually Work?
  7. Chapter 7: Indian Datasets & Real Problems
  8. Chapter 8: Deploy Your AI — Get a Public URL
  9. Capstone Build-It Projects
  10. Final Book Exam
  11. AI / ML / Python Glossary
  12. Career & College Pathways
  13. Series Completion Diploma

Practise for Class 10