Skip to main content

A model for emotion classification based on text and audio.

Project description

Emotion

A model for emotion classification based on text and audio.

emotion - merge MIT License

Acknowledgements

  • Hafed Benteftifa
  • Soumaya Chaffar

Features

Give audio and text as input and get back the dominant emotion.

Usage/Examples

Be sure to add double quotes to lines containing one or more commas for .csv files.

For graphical interface, use https://a62-emotion.herokuapp.com/index and upload .wav and .csv files.

In [1]: import requests

In [2]: with open("./data/raw_sample/audio/UlTJmndbGHM.wav", "rb") as fd:
   ...:     response = requests.post("https://a62-emotion.herokuapp.com/predict", files={'files[]': fd})
   ...:

In [3]: response.json()
Out[3]: {'predictions_audio': {'UlTJmndbGHM.wav': 'positive'}, 'predictions_texte': {}}
curl -F 'files[]=@/home/user/emotion/data/raw_sample/audio/DatH-ra0VKY.wav' -F 'files[]=@/home/user/file.csv' https://a62-emotion.herokuapp.com/predict
{"predictions_audio":{"DatH-ra0VKY.wav":"positive"},"predictions_texte":{"file.csv":{"DAMON WILLIAMS: I am the Senior Vice President and Chief Education and Youth Development Officer for the Boys and Girls Clubs of America.":"neutral","In that role, I help to shape the education policy and youth development direction for more than 4,000 clubs that are part of our federated network, having an impact on more than 4 million young people across this nation.":"positive"}}}

API Reference

Get a prediction for file(s)

  POST /predict
Parameter Type Description
files[] File Required. File(s) to process

Installation

Install emotion with pip

  pip install a62-emotion

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

GDRIVE_CREDENTIALS_DATA

FLASK_SECRET_KEY

System Dependencies

For audio, you will need to install libsndfile1 (and libsndfile1-dev on some systems)

sudo apt-get install libsndfile1

Run Locally

Be sure to have python 3.8.13 as the python executable

python3 --version

To install Poetry, run:

curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.14 python3 - --yes

(Optional) To install the Heroku CLI, follow these steps

https://devcenter.heroku.com/articles/heroku-cli#standalone-installation-with-a-tarball

Clone the project

git clone https://github.com/philipgaudreau/emotion

Go to the project directory

cd emotion

Install dependencies (add flag --without-dev if you do not want development dependencies)

poetry install

Activate the virtual environment

poetry shell

Pull cloud data if needed (You will need to export GDRIVE_CREDENTIALS_DATA)

dvc pull [<.dvc file>]

Start using the command line interface (Not implemented yet)

emotion --help

Running Tests

To run tests, run the following command (development dependencies must be installed)

pytest tests

Deployment

This project is automatically deployed on Heroku when a PR is merged. To test locally, run (You will need to export FLASK_SECRET_KEY)

heroku local

Tech Stack

CI: GitHub Actions, DVC

CD: GitHub Actions, Heroku

Frameworks: Scikit-learn, Tensorflow, Flask

Versionning: Poetry, SemVer

Cloud: G-Drive, GitHub, Heroku

Feedback

If you have any feedback, please reach out to one of us.

Authors

🚀 About Us

We are on our way to finish a degree in Machine Learning.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

a62-emotion-0.11.4.tar.gz (17.4 kB view details)

Uploaded Source

Built Distribution

a62_emotion-0.11.4-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file a62-emotion-0.11.4.tar.gz.

File metadata

  • Download URL: a62-emotion-0.11.4.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b1 CPython/3.8.13 Linux/5.13.0-1031-azure

File hashes

Hashes for a62-emotion-0.11.4.tar.gz
Algorithm Hash digest
SHA256 f8ffe83514f6da7f71ca96a198b9a9caf7fdd4485c0b213cec3ccd7d42ae6b3b
MD5 115b265edd8eb817eb310843ae6f650f
BLAKE2b-256 7600be6952f0a2a013426fb003e9e970b960cde5c7820e9361edbf31f7a2eb05

See more details on using hashes here.

File details

Details for the file a62_emotion-0.11.4-py3-none-any.whl.

File metadata

  • Download URL: a62_emotion-0.11.4-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.0b1 CPython/3.8.13 Linux/5.13.0-1031-azure

File hashes

Hashes for a62_emotion-0.11.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ab65cb0a247046a2108c2e1b0334ece1e0d0a6b043fccdfe34ce64aa1793cc4b
MD5 c620b09e4f755c8d3e378e83ea7c2e10
BLAKE2b-256 6de4b030fe2dec1245728123b901f21c208463d54189b12aeb8e48507ebf7c50

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page