This project is part of a larger goal: building a full-stack, end-to-end AI system inspired by the Harry Potter universe.
The current implementation focuses on spell classification, but the long-term vision is to expand this into a broader platform that integrates:
- machine learning models
- data pipelines
- backend APIs
- interactive frontend experiences
Future components of this platform include:
-
Sorting Hat Model
- Classify users into Hogwarts houses based on personality data
-
Spell Recommendation System
- Suggest spells based on user traits or context (content-based filtering)
-
Wizarding World Analytics Dashboard
- Visualize patterns in spells, houses, and character traits
-
Character Chat Interface
- Interact with AI personas (e.g., Hermione, Snape) using NLP
-
Audio Processing (Future)
- Detect speech vs magic-related content (ties into audio ML work)
The current version implements a baseline NLP classifier that predicts whether a spell is:
darknon-dark
This module demonstrates:
- data cleaning and preprocessing
- feature engineering (TF-IDF)
- model training and evaluation
- API deployment with FastAPI
- frontend integration
- User enters a spell description
- Frontend sends request to FastAPI backend
- Backend processes text using trained vectorizer
- ML model predicts:
darknon-dark
- Result is returned and displayed
Input: Avada Kedavra killing curse
Output: dark
The project includes a FastAPI backend that serves the spell classification model.
source venv/bin/activateuvicorn backend.main:app --reloadfrontend/index.html
-
GET /
Returns a basic API status message. -
GET /health
Returns API health status. -
POST /predict-spell
Predicts whether a spell description isdarkornon-dark.
{
"description": "causes unbearable pain"
}{
"description": "causes unbearable pain",
"prediction": "dark"
}- Model: Logistic Regression
- Features: TF-IDF vectorization
- Evaluation: Cross-validation (macro F1 ≈ 0.48)
- Small dataset (~70 samples)
- Class imbalance (few dark spells)
- Model tends to favor majority class