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:
- Input: Video or audio files are uploaded to the system.
- 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).
- Output: Generate a detailed report that includes the transcription along with sentiment analysis for each timestamp.
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.
-
Clone the Repository
~$ git clone https://github.com/ruxailab/sentiment-analysis-api.git ~$ cd sentiment-analysis-api/app
-
Create the Virtual Environment
~/sentiment-analysis-api/app$ python3 -m venv env
-
Activate the virtual environment
~/sentiment-analysis-api/app$ source env/bin/activate
-
Install Dependecies
~/sentiment-analysis-api/app$ pip install -r requirements.txt
-
Run Flask App
- In Debug Mode [port 8000]
~/sentiment-analysis-api/app$ python app.py
- In Debug Mode [port 8000]
-
Run API Documentation
- Access the API documentation at: http://localhost:8000/apidocs
- Clone the Repository
~$ git clone https://github.com/ruxailab/sentiment-analysis-api.git ~$ cd sentiment-analysis-api
- [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
- Build Image
~/sentiment-analysis-api$ docker build -t sentiment_analysis:v0 .
- 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
- Run API Documentation
- Access the API documentation at: http://localhost:8000/apidocs
- Clone the Repository
~$ git clone https://github.com/ruxailab/sentiment-analysis-api.git ~$ cd sentiment-analysis-api
- Build Image Using Docker Compose
~/sentiment-analysis-api$ docker-compose build
- Start Docker Container
~/sentiment-analysis-api$ docker-compose up
- Run API Documentation
- Access the API documentation at: http://localhost:8000/apidocs
You can access the API documentation at http://localhost:8000/apidocs after running the Flask App.
For testing the API endpoints, you can use the following Postman collection:
This repository is part of the Google Summer of Code (GSoC) 2024 program.
- Contributor: Basma Elhoseny
- Mentors: Karine - Marc - Vinícius - Murilo
- GSoC'24 Project Page: Sentiment Analysis API Project GSoC 24 Program
- Progress Tracking Docs: GSOC'24 Project Progress and Follow Up Sheet
- Meetings Presentations: Slides
- Main Reposotory for the Project: sentiment-analysis-api Repo
- Integration to RUXAILAB PR Requests:
- Wikkis:
This software is licensed under the MIT License. See the LICENSE file for more information.