TaahKay commited on
Commit
ea0dba1
Β·
verified Β·
1 Parent(s): 4a9476d

Update README.md (#1)

Browse files

- Update README.md (46d89dd3be9fb91354d0b3796232e36ef8714451)

Files changed (1) hide show
  1. README.md +139 -0
README.md CHANGED
@@ -18,3 +18,142 @@ Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :hear
18
 
19
  If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
20
  forums](https://discuss.streamlit.io).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
 
19
  If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
20
  forums](https://discuss.streamlit.io).
21
+
22
+
23
+ # πŸŽ™οΈ English Accent Audio Detector
24
+
25
+ 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.
26
+
27
+ πŸš€ Features
28
+ * βœ… Upload videos or provide YouTube/video url links
29
+
30
+ * 🎧 Automatic audio extraction and trimming (max 2 minutes)
31
+
32
+ * πŸ—£οΈ Transcription and English language filtering
33
+
34
+ * 🧠 Accent classification using a Wav2Vec2-based model
35
+
36
+ * πŸ’¬ Clear display of the speaker's accent and confidence score
37
+
38
+ ### πŸ§ͺ Model Information
39
+ This app uses the Accent-ID model developed by Juan Pablo Zuluaga on the CommonAccent dataset.
40
+
41
+ The model is implemented using the SpeechBrain toolkit, a powerful open-source speech processing framework built on PyTorch.
42
+
43
+
44
+ ## βš™οΈ Setup Instructions
45
+
46
+ This application requires **Python 3.10**. Follow these steps to install and run the app locally:
47
+
48
+ ---
49
+
50
+ * βœ… 1. Clone the Repository
51
+
52
+
53
+ git clone https://github.com/Taah-Kay/English_fluency_and_accent_detection.git
54
+ cd English_fluency_and_accent_detection
55
+
56
+ * 🐍 2. Set Up a Virtual Environment (Recommended)
57
+ python3.10 -m venv venv
58
+ source venv/bin/activate # On Windows: venv\Scripts\activate
59
+
60
+ * πŸ“¦ 3. Install Python Requirements
61
+ Make sure you're in the root folder, then run:
62
+ pip install -r requirements.txt
63
+
64
+ * πŸ› οΈ 4. Install System Dependencies
65
+ This app uses ffmpeg for audio/video processing. Install it based on your OS:
66
+ Ubuntu/Debian:
67
+ sudo apt update
68
+ sudo apt install ffmpeg
69
+
70
+ macOS (with Homebrew):
71
+ brew install ffmpeg
72
+
73
+ Windows:
74
+ Download from https://ffmpeg.org/download.html and add it to your system PATH.
75
+
76
+ * πŸ” 5. Set Your Hugging Face Token
77
+ * The app uses models from Hugging Face. You need an access token:
78
+
79
+ * Create a token at: https://huggingface.co/settings/tokens
80
+
81
+ Then set it as an environment variable:
82
+ * export HF_TOKEN=your_token_here # Linux/macOS
83
+ * set HF_TOKEN=your_token_here # Windows CMD
84
+ * $env:HF_TOKEN="your_token_here" # Windows PowerShell
85
+
86
+ * ▢️ 6. Run the App
87
+ Launch the Streamlit app:
88
+ streamlit run app.py
89
+ Then open your browser at: http://localhost:8501
90
+
91
+ ### πŸ“ Project Structure
92
+ <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>
93
+
94
+
95
+ ### πŸš€ How to Use
96
+ * Run the app:
97
+
98
+ * Choose Input Method:
99
+
100
+ * Upload a video file (.mp4, .mov, .avi, .mkv)
101
+
102
+ * Or paste a valid YouTube URL.
103
+
104
+ * Click "Download Video" (for YouTube) or upload file directly.
105
+
106
+ * Click "Extract Audio"
107
+ The app:
108
+
109
+ * Extracts and trims audio to 2 minutes
110
+
111
+ * Transcribes the content
112
+
113
+ * Checks for English language
114
+
115
+ * Click "Analyze Accent"
116
+
117
+ Displays the detected accent and confidence score.
118
+
119
+ ### 🧠 Supported English Accents
120
+ * American
121
+ * British
122
+ * Australian
123
+ * Indian
124
+ * Canadian
125
+ * Bermudian
126
+ * Scottish
127
+ * African
128
+ * Irish
129
+ * New Zealand
130
+ * Welsh
131
+ * Malaysian
132
+ * Philippine
133
+ * Singaporean
134
+ * Hong Kong
135
+ * South Atlantic
136
+
137
+ ### πŸ› οΈ Troubleshooting
138
+ FFmpeg Not Found: Ensure it’s installed and accessible from the terminal/command prompt.
139
+
140
+ Model Load Errors: Ensure your Hugging Face token is valid.
141
+
142
+ Audio Errors: Use clear, spoken English in the video/audio source.
143
+
144
+ ### πŸ“¬ Contact
145
+ Created by Ryan Kembo
146
+ πŸ“§ kemboryan@gmail.com
147
+ πŸ”—https://github.com/Taah-Kay
148
+
149
+ ### 🧾 Citation & Acknowledgements
150
+ This app uses the Accent-ID model from Hugging Face:
151
+
152
+ Juan Pablo Zuluaga – Jzuluaga/accent-id-commonaccent_xlsr-en-english
153
+ https://github.com/JuanPZuluaga/accent-recog-slt2022
154
+
155
+ Built on SpeechBrain, a general-purpose speech toolkit:
156
+
157
+ <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>
158
+
159
+