Skip to content

thisisankit27/SnapSpeak

Repository files navigation

SnapSpeak - Redefining Visual Storytelling

SnapSpeak is your go-to platform for transforming images into captivating narratives. Our user-friendly interface allows for seamless image uploads, drag-and-drop functionality, and on-the-go capture using the Media Stream API. Choose between our Image Caption Generator or OCR for versatile text extraction.

Behind the scenes, our server processes images with precision, employing advanced techniques like py-tesseract OCR and a finely tuned model trained on the Flickr30K dataset.

The future of SnapSpeak is bright. We're expanding with MongoDB integration for image storage, Docker deployment, and scaling on Digital Ocean's Kubernetes. Jenkins ensures a smooth development pipeline.

Join us in revolutionizing visual communication with SnapSpeak. Let your images do the talking.

Final.Demo.mp4

System Design

Untitled design_page-0001

Prerequisites

Before you begin, make sure you have the following installed and set up on your system:

Windows

  1. Tesseract OCR - Install Tesseract OCR for Windows using the installer: tesseract-ocr-w64-setup-5.3.3.20231005.exe.

  2. Set the system PATH for Tesseract to C:\Program Files\Tesseract-OCR.

  3. Create a new system environment variable:

    • Name: TESSDATA_PREFIX
    • Value: C:\Program Files\Tesseract-OCR\tessdata

Ubuntu

  1. Write these commands in the terminal:
    sudo apt-get update
    sudo apt-get install -y tesseract-ocr

Installation

  1. Clone the repository:

    git clone https://github.com/thisisankit27/SnapSpeak.git
  2. Navigate to the project directory:

    cd SnapSpeak
    cd MasterProject
  3. Install the Python dependencies:

    pip install -r requirements.txt
  4. Create a .env file in the same folder as manage.py. Add the following line to the .env file:

    DEBUG=1
    DJANGO_EXPOSE_PORT=8020
    DJANGO_PROD_PORT=8001
    SECRET_KEY=<your-secret-key>
    
    MONGODB_HOST=localhost
    MONGODB_EXPOSE_PORT=27017
    MONGODB_PROD_PORT=27017
    
    REDIS_PROD_PORT=6379
    REDIS_EXPOSE_PORT=6379
    
    CELERY_BROKER_URL = 'redis://localhost:6379/0'

    Replace <your-secret-key> with a securely generated secret key for your Django application. You can use online tools or Django's django.core.management.utils.get_random_secret_key() method to generate a new key. Make sure to keep this key confidential and never share it publicly.

  5. Collect the static files:

python manage.py collectstatic

Run the Application

Run the following command to start the Django development server:

python manage.py runserver

or

gunicorn MasterProject.wsgi:application --bind 127.0.0.1:8000

Run Celery

Run the following command in seperate terminal:

celery -A MasterProject worker --loglevel=info --concurrency 1 -E

Docker Installation

SnapSpeak can also be deployed using Docker for easier setup and portability. Follow these steps to run the application using Docker:

  1. Make sure you have Docker installed on your system. If not, you can download and install Docker Desktop from Docker's official website.

  2. Clone the repository:

    git clone https://github.com/thisisankit27/SnapSpeak.git
  3. Navigate to the project directory:

    cd SnapSpeak
    cd MasterProject
  4. Create a .env file in the same folder as manage.py. Add the following line to the .env file:

    DEBUG=1
    DJANGO_EXPOSE_PORT=8020
    DJANGO_PROD_PORT=8001
    SECRET_KEY=<your-secret-key>
    
    MONGODB_HOST=mongodb
    MONGODB_EXPOSE_PORT=27017
    MONGODB_PROD_PORT=27017
    
    REDIS_PROD_PORT=6379
    REDIS_EXPOSE_PORT=6379
    
    CELERY_BROKER_URL = 'redis://redis:6379/0'
    
    NGINX_EXPOSE_PORT=80
    NGINX_PROD_PORT=80

    Replace <your-secret-key> with a securely generated secret key for your Django application. You can use online tools or Django's django.core.management.utils.get_random_secret_key() method to generate a new key. Make sure to keep this key confidential and never share it publicly.

  5. Build and start the Docker containers using Docker Compose:

    docker compose up --build

    This command will build the Docker image and start the SnapSpeak application along with its dependencies.

  6. Access the SnapSpeak application by visiting http://localhost:80 or http://localhost in your web browser.

    The application should now be running in a Docker container, providing a convenient and isolated environment for SnapSpeak.

  7. To stop the Docker containers, use the following command:

    docker compose down

    This will stop and remove the containers.

Note: Ensure that ports 8001 & 80 on your local machine are available and not occupied by another service before running Docker Compose. Adjust the docker-compose.yml file if you need to change the port configuration.