/comments-summary-ml-project

This is a Youtube Comments Summarizer which I built using Streamlit and Open AI/Gemini APIs.

Primary LanguagePython

youtube-comments-summary-project

Please find my Streamlit app hosted here
Please note that if you face an error, the Open AI API credits on my account might have expired :D

Project Summary

The goal of this model is to provide a summary of comment threads for any given Youtube video.

Flow Diagram

Flow Diagram

Approach

  • In this project, I will be using Youtube API V3 to fetch all comment threads for any given youtube video id.
  • I used Streamlit to build this application. It takes a Youtube video url as input. Using the Youtube API, I fetch all the comment threads under that video and provide it to the Tokenizer to break the text into chunks.
  • Then I provide each chunk as an input to the Completions API with the prompt - “Provide a summary of the comments below.” followed by the chunk of comments. The model then returns a brief summary of how people are reacting to that video.

How to use

  1. Create a virtual environment (python3 -m venv venv && source venv/bin/activate)

  2. Download all the dependencies by running make requirements in your terminal

  3. Create a project on Google cloud console and enable Youtube API V3 for your project. Follow instructions here.

  4. Create a .streamlit folder at the source level and add a secrets.toml file to it.

  5. Ensure your Youtube API keys are set as API_SERVICE_NAME, API_VERSION, YOUTUBE_API_KEY in the secrets.toml file (check the secrets.toml.example file for reference). Please find the details to generate the API key here.

  6. Ensure your OpenAI API key is set as an environment variable OPENAI_API_KEY in the secrets.toml file (check the secrets.toml.example file for reference). (see best practices around API key safety here)

  7. Run the streamlit app by running make run

  8. Open the app in your browser at http://localhost:8501

Example

App_Demo