Downloads · 30 days
0
jdalfonso/fr-speech-emotion-classifier
fr-speech-emotion-classifier is a machine learning model from jdalfonso. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
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).
Downloads · 30 days
0
Access
Public
Updated Mar 14, 2025
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py13.1 KB · 58%
From the Hugging Face model README
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).
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.
First, install the required dependencies:
pip install -r requirements.txt
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}")
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}")
The model predicts the following emotion labels:
0: colère (anger)1: neutre (neutral)2: joie (joy)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}")
This project is licensed under the MIT License.