File size: 2,113 Bytes
f26a55e
f01c181
f26a55e
 
 
 
 
 
f01c181
f26a55e
 
 
 
465b605
f26a55e
465b605
f26a55e
465b605
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
title: Accent Classifier
emoji: 🚀
colorFrom: red
colorTo: red
sdk: docker
app_port: 8501
tags:
- streamlit
pinned: false
short_description: Streamlit template space
---

# English Accent Detector (SpeechBrain)

This Streamlit app detects English accents from speech in public video URLs using the SpeechBrain accent classification model.

---

## Features

- Input a public video URL (MP4, Loom, etc.)
- Downloads the video
- Extracts up to 60 seconds of audio
- Classifies English accent with confidence score
- Provides an explanation of the detected accent

---

## Requirements

- Python 3.12 or higher
- ffmpeg installed and available in PATH (required by `moviepy`)
- Internet connection (to download videos and model weights)

---

## Setup

1. **Clone the repo** (or copy your project files):

    ```bash
    git clone https://github.com/Kedar43/accent_detector.git
    cd accent_detector
    ```

2. **Create and activate a virtual environment (optional but recommended):**

    ```bash
    python -m venv venv
    source venv/bin/activate   # On Windows: venv\Scripts\activate
    ```

3. **Install dependencies:**

    ```bash
    pip install -r requirements.txt
    ```

---

## Usage

Run the Streamlit app:

```bash
streamlit run app.py
```

- This will open a browser window/tab with the app interface.
- Paste a public video URL (must be MP4).
- Wait while the app downloads the video and processes audio (up to 60 seconds).
- View the detected English accent, confidence score, and explanation.

---

## Testing the app
- Use sample public MP4 videos containing English speech with distinct accents.
- The app logs runtime info and errors to app.log in the working directory.
- If errors occur, check app.log for detailed traceback and messages.

---

## Notes
- The SpeechBrain model is loaded once and cached to improve performance on repeated runs.
- Temporary video and audio files are deleted automatically after processing.
- Accuracy depends on the quality of audio and the SpeechBrain model’s training data.
- Make sure video URLs are publicly accessible without authentication.