Downloads · 30 days
0
0% of all-time downloads
alec228/audio-sentiment
audio-sentiment is a machine learning model from alec228. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Ce projet propose un pipeline complet d'analyse de sentiment à partir de fichiers audio francophones, structuré en quatre composantes principales :
Downloads · 30 days
0
0% of all-time downloads
All-time downloads
21
Public
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py57.7 KB · 47%
From the Hugging Face model README
Ce projet propose un pipeline complet d'analyse de sentiment à partir de fichiers audio francophones, structuré en quatre composantes principales :
Transcription audio
jonatasgrosman/wav2vec2-large-xlsr-53-french)Analyse de sentiment textuel
nlptown/bert-base-multilingual-uncased-sentiment)analyze_sentiment(text) retournant un label (négatif, neutre, positif) et sa confianceInterface utilisateur Gradio

API REST FastAPI
/predict pour soumettre un fichier audio{ "transcription": ..., "sentiment": {label: confiance} }/docs)
sentiment_audio_tp/
├── hf_model/ # exports de modèles sauvegardés via save_pretrained
├── models/ # cache local HuggingFace (ignoré par Git)
├── src/
│ ├── __init__.py
│ ├── transcription.py # SpeechEncoder (Wav2Vec2Model)
│ ├── sentiment.py # TextEncoder + analyze_sentiment()
│ ├── multimodal.py # Classifieur multimodal (fusion embeddings)
│ ├── inference.py # CLI (audio → transcription + sentiment)
│ ├── app.py # Interface Gradio
│ └── api.py # Serveur FastAPI
├── requirements.txt # Dépendances du projet
├── render.yaml # Infra as code pour Render
└── README.md # Ce document
Cloner le dépôt
git clone <URL_DU_REPO>
cd sentiment_audio_tp
Configurer l'environnement
python -m venv venv
source venv/bin/activate # macOS/Linux
.\venv\Scripts\Activate.ps1 # Windows PowerShell
Installer les dépendances
pip install --upgrade pip
pip install -r requirements.txt
python src/inference.py chemin/vers/audio.wav
# Affiche la transcription et le résultat de sentiment
python -m src.app
http://127.0.0.1:7861/uvicorn src.api:app --reload --host 0.0.0.0 --port 8000
Swagger UI : http://127.0.0.1:8000/docs
Tester avec curl ou Postman :
curl -X POST "http://127.0.0.1:8000/predict" \
-F "file=@/chemin/vers/audio.wav"
pytest et pipelines CI/CDLicence MIT — libre d'utilisation, modification et redistribution.