Skip to content

Instantly share code, notes, and snippets.

View nirajpandkar's full-sized avatar

Niraj Pandkar nirajpandkar

View GitHub Profile
@nirajpandkar
nirajpandkar / simple_llama_index_demo
Created June 26, 2023 04:26
A simple llama index demo to query local files using OpenAI API.
# Import necessary packages
import os
import pickle
from llama_index import GPTSimpleVectorIndex, download_loader
os.environ['OPENAI_API_KEY'] = '<openai_api_key>'
# Load custom data source. Here it is being loaded from the data directory.
SimpleDirectoryReader = download_loader("SimpleDirectoryReader")
@nirajpandkar
nirajpandkar / Dockerfile
Created June 9, 2019 09:12
Dockerfile for captcha breaker
FROM python:3.6.3
# install Python modules needed by the Python app
COPY . /Captcha-Prediction
WORKDIR /Captcha-Prediction
RUN pip install --no-cache-dir -r requirements.txt
# tell the port number the container should expose
EXPOSE 5000
"""
This script removes stray lines from images using image processing techniques with OpenCV library.
All credit where it's due - https://stackoverflow.com/a/45563349/4411757. Simon Mourier created a script in C# which I
have ported to python. Tested with python 3.5 and opencv-python==3.4.2.17. Shoot your suggestions/improvements in the
comments. Cheers!
"""
def clean_image(img):
height, width = img.shape[:2]