Skip to content

Latest commit

 

History

History
160 lines (133 loc) · 8.7 KB

README.md

File metadata and controls

160 lines (133 loc) · 8.7 KB

Sentiment Analysis API

Table of Contents

Overview

This project is a standalone backend solution for sentiment analysis of video and audio files. It processes both complete files and segmented audio from one-sided or multi-speaker videos. The system provides sentiment analysis for each segment of the audio or video, including a transcription and its corresponding sentiment for each timestamp.

Developed as one of the main projects for RuxAiLab for GSoC '24, this tool integrates with the RuxAiLab project through RuxAiLab PRs. The pipeline involves:

  1. Input: Video or audio files are uploaded to the system.
  2. Pipeline Modules:
    • Audio Extraction: Extract audio from video files using MoviePy.
    • Transcription: Transcribe the audio using Whisper.
    • Sentiment Analysis: Analyze the transcription for sentiment using RoBERTa. Sentiment labels are POS (Positive), NEU (Neutral), and NEG (Negative).
  3. Output: Generate a detailed report that includes the transcription along with sentiment analysis for each timestamp.

Pipeline

This project aims to enhance RuxAiLab's capabilities by providing detailed sentiment insights along with transcriptions for better understanding and analysis for users of RuxAiLab.

Built Using

Get Started

Native

  1. Clone the Repository

    ~$ git clone https://github.com/ruxailab/sentiment-analysis-api.git
    ~$ cd sentiment-analysis-api/app
  2. Create the Virtual Environment

    ~/sentiment-analysis-api/app$ python3 -m venv env
  3. Activate the virtual environment

     ~/sentiment-analysis-api/app$ source env/bin/activate
  4. Install Dependecies

     ~/sentiment-analysis-api/app$ pip install -r requirements.txt
  5. Run Flask App

    • In Debug Mode [port 8000]
       ~/sentiment-analysis-api/app$ python app.py
  6. Run API Documentation

Docker

  1. Clone the Repository
    ~$ git clone https://github.com/ruxailab/sentiment-analysis-api.git
    ~$ cd sentiment-analysis-api
  2. [Optional if you want to use video saved on your machine] Copy Your Video File to /sentiment-analysis-api/demos
    ~/sentiment-analysis-api$  cp <Video_file_absolute_path> ./demos
  3. Build Image
    ~/sentiment-analysis-api$ docker build -t sentiment_analysis:v0 .
  4. Start Docker Conatiner (Port 8000)
    ~/sentiment-analysis-api$ docker run --name sentiment_container -p 8000:8000 -v ./demos:/sentiment_analysis_app/demos sentiment_analysis:v0
  5. Run API Documentation

Docker Compose

  1. Clone the Repository
    ~$ git clone https://github.com/ruxailab/sentiment-analysis-api.git
    ~$ cd sentiment-analysis-api
  2. Build Image Using Docker Compose
     ~/sentiment-analysis-api$ docker-compose build
  3. Start Docker Container
    ~/sentiment-analysis-api$ docker-compose up
  4. Run API Documentation

API Documentation

You can access the API documentation at http://localhost:8000/apidocs after running the Flask App.

Postman Collection

For testing the API endpoints, you can use the following Postman collection:

GSoC Docs

This repository is part of the Google Summer of Code (GSoC) 2024 program.

Useful Links:

License

This software is licensed under the MIT License. See the LICENSE file for more information.

© 2024 RUXAILAB.