Skip to content

rkhatta1/TheVersusProject

Repository files navigation


Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge

The Versus Project

Project Overview

I love @versus, and that's why I fine-tuned an LLM on versus' captions and made an end-to-end AI content tool with it. Low-cost deployment for projects featuring local LLM's is essentially non-existent, so I decided against deployment.

Tech Stack

  • Backend: Python, Flask, Flask-JWT-Extended, Flask-Bcrypt
  • Frontend: React (with Vite), Tailwind CSS, shadcn/ui
  • Database: PostgreSQL (managed with Docker Compose)
  • AI & APIs: Google Gemini, Instagrapi, Newspaper3k
  • Containerization: Docker

Local Development Setup

Prerequisites

  • Python>=3.10
  • Node.js and npm
  • Docker and Docker Compose
  • Kaggle account

Step 1: Set Up the Backend

  1. Create and activate a Python virtual environment:

    python3 -m venv .venv
    source .venv/bin/activate
  2. Install Python dependencies:

    pip install -r requirements.txt
  3. Create an Instagram session:

  • Tip: Login to the same instagram account on your browser as well, and browse around normally, every once in a while. This will keep your session from being tagged as "abnormal".

    python3 insta_login.py

Step 2: Set Up the Frontend

  1. Navigate to the frontend directory:

    cd frontend
  2. Install Node.js dependencies:

    npm install
  3. Return to the root directory:

    cd ..

Step 3: Configure Environment Variables

  • Create a .env file in the root of the project and add the following variables:

    # --- Gemini API Key ---
    GEMINI=<your-gemini-api-key>
    
    # --- Instagram Credentials ---
    INSTA_USERNAME=<your_instagram_username>
    INSTA_PASSWORD=<your_instagram_password>
    
    # --- Kaggle Inference Server URL ---
    KAGGLE_INFERENCE_URL=https://your-ngrok-url.ngrok-free.app
    
    # --- PostgreSQL Database Credentials ---
    POSTGRES_USER=versusdb
    POSTGRES_PASSWORD=<your_secure_password>
    POSTGRES_DB=versus_db
    POSTGRES_PORT=5433
    
    # --- RSS Feed URL ---
    RSS_FEED=https://www.theguardian.com/football/rss
    
    # --- JWT Secret Key ---
    JWT_SECRET_KEY=<a_very_strong_and_secret_key>

Step 4: Set Up the Kaggle Notebook

  • Kaggle Config:

    T4/P100 GPU
    Enable Internet
    
    # -- Secretes --
    NGROK_AUTHTOKEN=<your-ngrok-auth-token>
    NGROK_DOMAIN=https://your-ngrok-url.ngrok-free.app
    HF_TOKEN=<your-huggingface-access-token>
  • Sample Inference Server:

    # ---------------------------------- Cell #1 ----------------------------------
    !pip uninstall -y torch torchvision torchaudio numpy
    
    
    # ---------------------------------- Cell #2 ----------------------------------
    !pip install numpy==1.26.4
    
    
    # ---------------------------------- Cell #3 ----------------------------------
    !pip install torch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 --index-url https://download.pytorch.org/whl/cu121
    
    
    # ---------------------------------- Cell #4 ----------------------------------
    !pip install --upgrade transformers peft accelerate bitsandbytes datasets trl flask pyngrok
    
    
    # ---------------------------------- Cell #5 ----------------------------------
    # Refer inference_example.py
    # Make sure to "Restart and Clear All Cell Outputs" after installing all the dependencies.

Step 5: Start the Services

  1. Start the PostgreSQL Database:
  • Open a terminal in the project root and run:
    docker compose up -d
  1. Start the Backend Server:
  • In a new terminal, make sure your Python virtual environment is activated, and run the Flask application:
    python app_ig.py
  1. Start the Frontend Development Server:
  • In a third terminal, navigate to the frontend directory.
  • Run the Vite development server:
    npm run dev

About

An AI content tool to fetch the latest, global football news and create versus' style captions for it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published