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.

