--- 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)