File size: 5,348 Bytes
e136ea6 66b3183 e136ea6 66b3183 e136ea6 66b3183 e136ea6 ea0dba1 835d4fd ea0dba1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
---
title: English Accent Detection
emoji: π
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: 'Streamlit application that detects the English accent '
license: mit
---
# ποΈ English Accent Audio Detector
This Streamlit web application detects the English accent of a speaker in a video or audio file. It leverages pre-trained machine learning models and allows users to upload a video or input a YouTube URL. The app extracts and trims the audio, transcribes the speech, filters for English language, and then predicts the accent from a set of common English accents.
π Features
* β
Upload videos or provide YouTube/video url links
* π§ Automatic audio extraction and trimming (max 2 minutes)
* π£οΈ Transcription and English language filtering
* π§ Accent classification using a Wav2Vec2-based model
* π¬ Clear display of the speaker's accent and confidence score
### π§ͺ Model Information
This app uses the Accent-ID model developed by Juan Pablo Zuluaga on the CommonAccent dataset.
The model is implemented using the SpeechBrain toolkit, a powerful open-source speech processing framework built on PyTorch.
### π How to Use
* Run the app:
* Choose Input Method:
* Upload a video file (.mp4, .mov, .avi, .mkv)
* Or paste a valid YouTube URL.
* Click "Download Video" (for YouTube) or upload file directly.
* Click "Extract Audio"
The app:
* Extracts and trims audio to 2 minutes
* Transcribes the content
* Checks for English language
* Click "Analyze Accent"
Displays the detected accent and confidence score
### π§ Supported English Accents
* American
* British
* Australian
* Indian
* Canadian
* Bermudian
* Scottish
* African
* Irish
* New Zealand
* Welsh
* Malaysian
* Philippine
* Singaporean
* Hong Kong
* South Atlantic
## βοΈ Setup Instructions
This application requires **Python 3.10**. Follow these steps to install and run the app locally:
---
* β
1. Clone the Repository
git clone https://github.com/Taah-Kay/English_fluency_and_accent_detection.git
cd English_fluency_and_accent_detection
* π 2. Set Up a Virtual Environment (Recommended)
python3.10 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
* π¦ 3. Install Python Requirements
Make sure you're in the root folder, then run:
pip install -r requirements.txt
* π οΈ 4. Install System Dependencies
This app uses ffmpeg for audio/video processing. Install it based on your OS:
Ubuntu/Debian:
sudo apt update
sudo apt install ffmpeg
macOS (with Homebrew):
brew install ffmpeg
Windows:
Download from https://ffmpeg.org/download.html and add it to your system PATH.
* π 5. Set Your Hugging Face Token
* The app uses models from Hugging Face. You need an access token:
* Create a token at: https://huggingface.co/settings/tokens
Then set it as an environment variable:
* export HF_TOKEN=your_token_here # Linux/macOS
* set HF_TOKEN=your_token_here # Windows CMD
* $env:HF_TOKEN="your_token_here" # Windows PowerShell
* βΆοΈ 6. Run the App
Launch the Streamlit app:
streamlit run app.py
Then open your browser at: http://localhost:8501
### π Project Structure
<pre lang="text"> English_Accent_Audio_Detector/ βββ app.py # Main Streamlit application βββ README.md # Project documentation with usage instructions βββ requirements.txt # Python dependencies βββ packages.txt # System-level packages (e.g., ffmpeg) βββ utils/ # Utility modules β βββ __init__.py # Makes utils a package β βββ accent_analysis.py # Logic for analyzing and classifying accents β βββ audio_processing.py# Audio trimming and processing β βββ session_utils.py # Session state utilities β βββ video_processing.py# YouTube/video handling βββ models/ # Model management βββ __init__.py # Makes models a package βββ custom_interface.py# HuggingFace interface for the model βββ model_loader.py # Loads Wav2Vec2 and Whisper models </pre>
### π οΈ Troubleshooting
FFmpeg Not Found: Ensure itβs installed and accessible from the terminal/command prompt.
Model Load Errors: Ensure your Hugging Face token is valid.
Audio Errors: Use clear, spoken English in the video/audio source.
### π¬ Contact
Created by Ryan Kembo
π§ kemboryan@gmail.com
πhttps://github.com/Taah-Kay
### π§Ύ Citation & Acknowledgements
This app uses the Accent-ID model from Hugging Face:
Juan Pablo Zuluaga β Jzuluaga/accent-id-commonaccent_xlsr-en-english
https://github.com/JuanPZuluaga/accent-recog-slt2022
Built on SpeechBrain, a general-purpose speech toolkit:
<pre lang="markdown"> ```bibtex @misc{speechbrain, title={{SpeechBrain}: A General-Purpose Speech Toolkit}, author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and FranΓ§ois Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio}, year={2021}, eprint={2106.04624}, archivePrefix={arXiv}, primaryClass={eess.AS}, note={arXiv:2106.04624} } ``` </pre>
|