A Deep Learning project that uses HuggingFace's Wav2Vec2 model to classify English audio accents as Canadian 🇨🇦 or British (England) 🏴.
Built with PyTorch, Transformers, and Librosa, this project achieves high accuracy on voice-based accent prediction.
🤗 Try the Live Demo on 👉 Hugging Face Spaces
🧠 Live Accent Classification App deployed on Hugging Face !!
Below are various graphs and charts generated to evaluate and visualize the performance of the Wav2Vec2-based Accent Classifier:
Class-wise prediction confidence of the model.
Loss reduction over training epochs showing model learning progress.
Matrix showing the number of correct and incorrect predictions per class.
A sleek, dark-themed Gradio interface has been added to make accent classification interactive and user-friendly!
- 🎤 Supports both microphone recording and file upload.
- 🧠 Uses the fine-tuned
Wav2Vec2model for detecting Canadian or British English accents. - 🌌 Clean dark mode layout with colorful buttons for a smooth user experience.
- ✅ Built with
gradio==5.38.2.
🚀 Simply run
app.pyto launch the app locally:python app.py
- Fine-tuned Wav2Vec2-Large-960h model
- Custom classification head for binary accent classification
- Achieved 97.83% Accuracy, 100% Precision, 97.62% F1 Score
- Audio pre-processing with Librosa & Torchaudio
- Exportable results in CSV + visualizations
- Easy-to-use Jupyter Notebook interface
- Python
- PyTorch
- HuggingFace Transformers
- Librosa
- Scikit-learn
- Matplotlib / Seaborn
- Git / GitHub
Follow these steps to set up the project on your local machine.
- Python 3.9 or higher
- Git installed (Download Git)
git clone https://github.com/creativepurus/Accent_Classification.git
cd Accent_Classification# Create venv (do this only once)
python -m venv venv
# Activate venv
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activatepip install -r requirements.txtjupyter notebookOpen en_model.ipynb and run the cells step-by-step.
model_predictions.csv→ Stores predictions with confidence- Graphs folder → Contains plots like confusion matrix, class-wise distribution
- Trained model saved to
wav2vec2-accent-classifier/
Accent_Classification/
├── .github/ # GitHub workflows, actions, or templates
├── assets/ # Images or media assets for README or UI
├── Data/ # Audio + tsv files
├── Graphs/ # Evaluation plots
├── Model/ # Saved Model and processor files (auto-created after training)
├── Accent_Detection_Model.ipynb # Main notebook
├── app.py # Gradio-based UI Application
├── Code_Explanation.md # Detailed explanation of model and code
├── LICENSE # Project license file
├── README.md # Project overview and instructions
├── requirements.txt # Python dependencies
└── .gitignore # Git ignore rules for GitHub
- Don’t forget to activate your virtual environment before installing packages or running the notebook.
- Make sure audio files and
validated.tsvare placed correctly in theen/folder.
- Add support for more accents (e.g., Australian, Indian, American)
- Deploy as a full-fledged web app
- Integrate with Flask/FastAPI for production API
Made with ❤️ by Anand Purushottam
This project is licensed under the GNU GENERAL PUBLIC LICENSE.

