File size: 4,397 Bytes
8b0afcc
 
97f0ffd
 
 
 
 
 
 
 
 
 
 
 
 
 
8b0afcc
97f0ffd
 
 
 
b4dd1c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0c9f651
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b4dd1c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
766e257
b4dd1c0
766e257
 
 
 
 
 
 
 
 
 
 
 
 
b4dd1c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
97f0ffd
 
b4dd1c0
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
language:
- en
metrics:
- accuracy
- f1
pipeline_tag: audio-classification
tags:
- space
- audio
- stuttering
- machine-learning
- scikit-learn
- healthcare
- classification
---
## GitHub

https://github.com/Earwigmoth10/stuttering-detection-classifier.git

---
title: SpeakFlow AI
emoji: 
colorFrom: blue
colorTo: teal
sdk: docker
app_port: 5000
pinned: false
---

# SpeakFlow AI 

**AI-Powered Speech Stuttering Detection System**

SpeakFlow AI analyzes uploaded or recorded speech audio and detects whether it contains normal speech or stuttering patterns, using MFCC feature extraction and a Random Forest classifier.

---

##  Features

-  Audio upload & live in-browser recording
-  ML-based stutter detection (40 MFCC features + Random Forest)
-  Confidence & fluency scoring on every prediction
-  Downloadable PDF report of each analysis
-  Searchable analysis history
-  User accounts (sign up, log in, edit profile, change password)
-  Admin dashboard — user management, analytics charts, CSV export
-  Dark mode, responsive UI

---
## Frontend

![Capture](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/XqTL13_tJzbqqIkqX1-jN.png)

![2](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/8EKs21scwFQSF6p08Flkj.png)

![4](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/2X5lMk1X487_dSMC47ExA.png)

![5](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/1rowa7Lj3iXiae6LGNMmN.png)

![6](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/JDBsgkxDUFSFYI-ls_prs.png)

![11](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/QhbazTOzS7tj7M_XI_iI2.png)

![13](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/twmyT3mY3M-1EvLcKm0G6.png)

![10](https://cdn-uploads.huggingface.co/production/uploads/6a64d94c3ea93aefcffbbd53/OxBaZTkCC1DTdhGoKmnsw.png)

## Tech Stack

**Frontend:** HTML5, CSS3, Vanilla JavaScript, Chart.js, jsPDF, Font Awesome
**Backend:** Python, Flask, Flask-CORS, Librosa, Scikit-learn, NumPy, Joblib

---

## How It Works

1. User uploads or records a WAV/MP3 file
2. Audio is preprocessed (noise reduction, normalization, silence trimming)
3. 40 MFCCs are extracted using Librosa
4. Feature vector is classified by a trained Random Forest model
5. App returns Normal / Stutter prediction with a confidence score

---
## Dataset

This model was trained using publicly available speech datasets from the following sources:

### Stuttering Speech Dataset
- **UCLASS Stuttered Speech Clips (SEP-28k Format)**
- Source: https://www.kaggle.com/datasets/vudominhgiang/uclass-stuttered-speech-clips-sep-28k-format

### Fluent (Normal) Speech Dataset
- **Mozilla Common Voice**
- Source: https://commonvoice.mozilla.org/

The datasets were preprocessed and combined to create a binary classification dataset for distinguishing between **Fluent Speech** and **Stuttering Speech**.

> **Note:** The datasets are **not redistributed** in this repository. Please download them from their respective official sources and ensure compliance with their licenses before use.
## Running This Space

This Space runs a Flask backend that serves the ML prediction API. On startup it will be available at the URL shown in the Space's embedded app window.

- Backend endpoint: `/api/predict` (POST, multipart audio upload)
- Health check: `/`

> Note: This app was originally built to run with a separate local frontend (`index.html` + `http.server`) talking to `127.0.0.1:5000`. When deployed here, the frontend's API base URL points at this Space's backend instead of localhost.

---

## Admin Access

An admin account is configured in the login flow to access the admin dashboard (user management, analytics, CSV export).

> **Demo project notice:** User accounts, sessions, and analysis history are stored in browser `localStorage`, not a real database, and passwords are not hashed. This project is for academic/demo purposes only — not intended for production use with real user data.

---

## Model Details

- **Feature extraction:** 40 MFCCs averaged over time (Librosa)
- **Classifier:** Random Forest (Scikit-learn)
- **Classes:** Normal speech vs. Stuttered speech
- **Training data:** 8,000+ labeled audio samples

---

## Author

Laiba Aamir (reawigmoth)