accent-detection / README.md
tusker123's picture
Update README.md
855b9e8 verified

A newer version of the Gradio SDK is available: 5.34.2

Upgrade
metadata
title: English Accent Classifier
emoji: 🗣️
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.30.0
app_file: app.py
pinned: false

Overview

This web app uses Gradio and Hugging Face Transformers to classify English accents from audio samples.

Upload or record English speech, and the app predicts the speaker’s accent from:

American

British

Indian

African

Australian

Results are displayed in a clear, color-coded table showing confidence percentages, highlighting the top predicted accent.

Demo Try the live app on Hugging Face Spaces:

https://huggingface.co/spaces/tusker123/accent-detection

Installation Clone the repo and install dependencies:

bash git clone https://github.com/your-username/english-accent-classifier.git cd english-accent-classifier

Optional: create and activate virtual environment

python -m venv venv

On Linux/macOS:

source venv/bin/activate

On Windows:

venv\Scripts\activate

pip install -r requirements.txt If requirements.txt is not included, install manually:

bash pip install gradio transformers torch Running Locally Start the app:

bash python app.py Open the local URL printed (usually http://127.0.0.1:7860) in your browser.

Deploying on Hugging Face Spaces Create a new Space on Hugging Face using the Gradio SDK.

Upload your app.py and requirements.txt.

Ensure your app.py ends with:

#python gr.Interface(...).launch() (Do NOT use share=True on Spaces.)

Commit and wait for the build; your app will be publicly available.

How It Works Uses the Hugging Face pipeline:

#python

pipeline("audio-classification", model="dima806/english_accents_classification") Takes an audio input, predicts accents with confidence scores.

Displays top 3 accents in a styled table with the top accent highlighted.

Error Handling Handles invalid audio files gracefully with user-friendly error messages.

Supports common audio formats like .wav and .mp3.

Customization Change the model in app.py by editing:

#python pipe = pipeline("audio-classification", model="your_model_name") Customize UI elements and theme in the Gradio interface.

License & Acknowledgments

This project leverages open-source libraries:

Gradio

Transformers

Model by dima806

Contact For inquiries or support, contact: duncan.ngacha@gmail.com