Skip to content

Instantly share code, notes, and snippets.

View codeperfectplus's full-sized avatar
🟢
Online

Deepak Raj codeperfectplus

🟢
Online
View GitHub Profile
@codeperfectplus
codeperfectplus / postQuantization.py
Created March 22, 2021 08:57
Post Quantization TFLITE model
# save this file as postQuantization.py
def representative_dataset():
for _ in range(100):
data = np.random.rand(1, 320, 320, 3)
yield [data.astype(np.float32)]
import numpy as np
import tensorflow as tf
saved_model_dir = "output/exported_models/tflite_infernce/saved_model"
''' Writing MetaData to TfLite Model
save it as MetaDataWriterFile.py'''
from tflite_support.metadata_writers import object_detector
from tflite_support.metadata_writers import writer_utils
from tflite_support import metadata
ObjectDetectorWriter = object_detector.MetadataWriter
_MODEL_PATH = <tf_lite_model_path>
_LABEL_FILE = <label_path>
@codeperfectplus
codeperfectplus / tessractOCR.py
Created April 19, 2021 06:25
Optical Character Recognition Using PyTesseract
from PIL import Image
import pytesseract
pytesseract.pytesseract.tesseract_cmd = r"path_to_tessract.exe"
def ocr(filename):
img = Image.open(filename)
text = pytesseract.image_to_string(img)
return text
@codeperfectplus
codeperfectplus / webhook.py
Last active April 23, 2021 13:10
Send Discord message using webhook and asynchronous api
# Send discord message using webhook and asynchronous api with aiohttp and asyncio
# Asynchronous calls do not block (or wait) for the API call to return from the server.
# Execution continues on in your program, and when the call returns from the server, a “callback” function is executed.
```python
import aiohttp
import asyncio
url = "<your url>" #webhook url, from here: https://i.imgur.com/f9XnAew.png
@codeperfectplus
codeperfectplus / githhubScrapper.py
Last active April 24, 2021 15:17
scrap github user data using async api and save in sqlite database
'''
Script to get GitHub user Data using Asynchronous API, logging and save the output in the SQLite Database.
'''
import logging
import sqlite3
import aiohttp
import asyncio
from sqlite3 import Error
async def fetch_github(url):
@codeperfectplus
codeperfectplus / tensorboard_colab.ipynb
Created April 28, 2021 06:16
run tensorboard on colab
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
""" python gist to create parser """"
import argparse
def add(x, y):
""" it will return the addition of x and y """
return x + y
parser = argparse.ArgumentParser()
parser.add_argument('--x', type=int, default=1)
@codeperfectplus
codeperfectplus / GitCommitEmoji.md
Created November 4, 2022 17:21 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
@codeperfectplus
codeperfectplus / how-to-solve-linear-equations-with-matrix-inversion.txt
Last active August 29, 2023 09:35
how-to-solve-linear-equations-with-matrix-inversion
""" Solver Linear equation using inverse matrix """
import numpy as np
class LinearEquationSolver(object):
""" Linear Equation solver using inverse matrix
equation: AX = B
X = inverse(A) . B
from flask import Flask, jsonify, request
# Create a Flask app
app = Flask(__name__)
# sample superhero data
superheroes = [
{
"id": 1,
"name": "Superman",
"email": "[email protected]",