basantetlhive/speech-abuse-detector

0

stars

11

commits

Python

primary language

Sep 15, 2024

updated

README

Speech Abuse Detector

1. Files Overview

  • app.py:
    The main entry point of the application, handles the routing and runs the Flask server. It sets up the / route to serve the front-end interface and /process to handle the speech recognition and classification requests.

  • detector.py:
    This file contains the SpeechAbuseDetector class, which encapsulates the logic for:

    • Capturing audio via microphone.
    • Converting audio to text using the SpeechRecognition library.
    • Using a pre-trained model from Hugging Face to classify text as "abusive" or "not abusive".
  • templates/index.html:
    The HTML template for rendering the user interface. The user interacts with the app by clicking a button to start recording their voice.

  • static/script.js:
    JavaScript logic to make a POST request to the server when the user clicks the button, sending the speech recognition result to the backend for classification.


2. Dependencies

Before running the project, ensure you have the following dependencies installed:

pip install flask speechrecognition transformers torch

3. How to Run the Project

3.1 Setup

  1. Install dependencies:
    First, install the necessary Python libraries by running the following command:
    pip install flask speechrecognition transformers torch
    

3.2 Running the Flask Application

  1. Navigate to the project directory in your terminal.

  2. Start the Flask application by running the following command:

    python app.py
    

3.Open your browser and go to: http://127.0.0.1:5000/

Contributors

basantetlhive

11 commits

basantetlhive/speech-abuse-detector

0

stars

11

commits

Python

primary language

Sep 15, 2024

updated

README

Speech Abuse Detector

1. Files Overview

  • app.py:
    The main entry point of the application, handles the routing and runs the Flask server. It sets up the / route to serve the front-end interface and /process to handle the speech recognition and classification requests.

  • detector.py:
    This file contains the SpeechAbuseDetector class, which encapsulates the logic for:

    • Capturing audio via microphone.
    • Converting audio to text using the SpeechRecognition library.
    • Using a pre-trained model from Hugging Face to classify text as "abusive" or "not abusive".
  • templates/index.html:
    The HTML template for rendering the user interface. The user interacts with the app by clicking a button to start recording their voice.

  • static/script.js:
    JavaScript logic to make a POST request to the server when the user clicks the button, sending the speech recognition result to the backend for classification.


2. Dependencies

Before running the project, ensure you have the following dependencies installed:

pip install flask speechrecognition transformers torch

3. How to Run the Project

3.1 Setup

  1. Install dependencies:
    First, install the necessary Python libraries by running the following command:
    pip install flask speechrecognition transformers torch
    

3.2 Running the Flask Application

  1. Navigate to the project directory in your terminal.

  2. Start the Flask application by running the following command:

    python app.py
    

3.Open your browser and go to: http://127.0.0.1:5000/

Contributors

basantetlhive

11 commits

Languages

Python

73.1%

HTML

14.9%

JavaScript

12.0%