French Speech Emotion Classifier

This repository contains a model for classifying emotions in French speech. The model is trained to recognize three emotions: anger (colère), neutral (neutre), and joy (joie).

Model Details

The model is based on a sequence classification architecture and uses MFCC (Mel-frequency cepstral coefficients) features extracted from audio files. It is fine-tuned on a dataset of French speech samples labeled with emotions.

How to Use

Installation

First, install the required dependencies:

pip install -r requirements.txt

Inference

To use the model for emotion classification, you can use the inference.py script. Here is an example of how to use it:

from inference import predict

audio_path = "path_to_your_audio_file.wav"
predicted_emotion, probabilities = predict(audio_path)
print(f"🎤 L'émotion prédite est : {predicted_emotion}")
print(f"📊 Probabilités par classe : {probabilities}")

Predicting Emotion from Audio File

You can also use the predict.py script to predict the emotion from an audio file. Here is an example of how to use it:

from predict import predict_emotion

audio_path = "path_to_your_audio_file.wav"
predicted_emotion, probabilities = predict_emotion(audio_path)
print(f"🎤 L'émotion prédite est : {predicted_emotion}")
print(f"📊 Probabilités par classe : {probabilities}")

Labels

The model predicts the following emotion labels:

  • 0: colère (anger)
  • 1: neutre (neutral)
  • 2: joie (joy)

Example Usage

Here is an example of how to use the predict.py script:

if __name__ == "__main__":
    base_path = os.path.abspath(os.path.join(os.path.dirname(__file__), "data"))
    audio_file = os.path.join(base_path, "colere", "c1ac.wav")

    predicted_emotion, probabilities = predict_emotion(audio_file)

    print(f"🎤 L'émotion prédite est : {predicted_emotion}")
    print(f"📊 Probabilités par classe : {probabilities}")

License

This project is licensed under the MIT License.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support