.. image:: _static/emotion_detective.png :alt: Emotion Detective Logo :width: 500 :align: center Overview -------- This NLP project provides functions to analyze emotions in video or audio files. It offers a comprehensive set of tools to detect and analyze emotions at a sentence level, producing valuable insights into the emotional content of multimedia sources. It includes a package with all necessary functions, two pipelines -- one for training the NLP model and one for inference, and Sphinx documentation. .. toctree:: :maxdepth: 3 :caption: Contents: data_preparation_inference data_preparation_training logger models pipelines Installation ------------ To install the package and its dependencies, use the following pip command: .. code-block:: bash pip install emotion_detective Dependencies ------------ The emotion_detective package requires the following dependencies: - python ^3.9 - pandas ^2.0.0 - nltk: - Version ^3.6.3 for win32 platforms - Version 3.8.1 for linux platforms - regex 2024.5.10 - moviepy 1.0.3 - pydub 0.25.1 - imageio 2.34.1 - imageio-ffmpeg 0.4.9 - scikit-learn ^1.0 - transformers ^4.30.0 - gensim ^4.3.2 - torch ^2.1.2 - numpy 1.23.2 - torchvision ^0.16.2 - setuptools-rust 1.9.0 - scipy 1.12 - pyspellchecker ^0.8.1 - accelerate >=0.20.1 - fastapi >=0.111.0 - uvicorn ^0.22.0 - typer >=0.12.3 - tokenizers: - Version 0.19 for win32 platforms - Version 0.11.1 for linux platforms - safetensors 0.4.2 - wordninja ^2.0.0 - textblob ^0.18.0.post0 - azureml-core ^1.56.0 - azureml-fsspec ^1.3.1 - sphinx-rtd-theme ^2.0.0 - h5py ^3.11.0 - matplotlib ^3.9.0 - mlflow ^2.13.2 - colorama ^0.4.6 - datasets ^2.20.0 - azureml-mlflow ^1.56.0 - azure-ai-ml ^1.17.0 Additional Dependencies ------------------------ The package also requires to have the following dependencies installed on your system. To install the additional dependencies, refer to the installation documentation linked below: - `Rust `_ - `Cuda Toolkit `_ Using the API ------------- The Emotion Detective package also offers an API for the training and inference pipeline. To use the API, create a simple POST request containing the arguments for the specific pipeline. Here is an example using the python library 'requests': .. code-block:: python import requests import json url = ""194.171.191.226:3950/train" payload = json.dumps({ "train_data_path": "./data/CSV/5000_sampled_emotions_neutral.csv", "test_data_path": "./data/CSV/val_set_5000.csv", "text_column": "text", "emotion_column": "label", "num_epochs": 1, "model_type": "rnn", "model_dir": "./models", "model_name": "rnn_test_api", "learning_rate": 0.001, "train_batch_size": 4, "eval_batch_size": 8, "cloud_logging": False }) headers = { 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) .. code-block:: python import requests import json url = "194.171.191.226:3950/inference" payload = json.dumps({ "input_media_path": "./data/EmotionsforKids.mp3", "model_path": "./models/rnn.pth", "model_type": "rnn", "emotion_mapping_path": "./models/mapping_emotions_rnn.json" }) headers = { 'Content-Type': 'application/json' } response = requests.request("POST", url, headers=headers, data=payload) print(response.text) Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search`