Skip to content

Instantly share code, notes, and snippets.

View ZackAkil's full-sized avatar

Zack Akil ZackAkil

View GitHub Profile
@ZackAkil
ZackAkil / app.py
Created June 14, 2023 07:30
Server
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello, World!'
@app.route('/<path:path>')
def serve_files(path):
@ZackAkil
ZackAkil / appscript.gs
Last active December 2, 2022 11:54
Build a desicion tree from a spreadsheet.ipynb
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu("🔮 Predictions for cell")
.addItem('🌸 Iris', 'predict_on_row')
.addToUi();
}
@ZackAkil
ZackAkil / automl-edge-tflite-metadata.ipynb
Created November 7, 2022 12:22
automl-edge-tflite-metadata.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python3
# rpi_ws281x library strandtest example
# Author: Tony DiCola (tony@tonydicola.com)
#
# Direct port of the Arduino NeoPixel library strandtest example. Showcases
# various animations on a strip of NeoPixels.
import time
from rpi_ws281x import *
import argparse
@ZackAkil
ZackAkil / cv_thumbnails.py
Created July 12, 2021 18:58
Using CV2 generate folders of thumbnails given a folder of videos.
# given a folder of videos, generate thumbnails for each video and store them in a new folder structure
# !pip install opencv-python
# !sudo apt-get install ffmpeg libsm6 libxext6 -y
import cv2
import os
from PIL import Image
@ZackAkil
ZackAkil / gs_folders_to_labels_file.py
Created July 12, 2021 11:43
Script to generate the labels csv file for AutoML Image Classification (Vertex AI) based on folder structure within google cloud storage
from google.cloud import storage
folder_location = 'YOUR GCS FOLDER LOCATION' # e.g automl-ui-dataset/x-ray-dataset
parts = folder_location.split('/')
bucket_name = parts[0]
prefix = '/'.join(parts[1:]) if len(parts) > 1 else ''
storage_client = storage.Client()
blobs = storage_client.list_blobs(bucket_name, prefix=prefix)
@ZackAkil
ZackAkil / main.py
Last active May 20, 2021 17:29
Google Cloud Function code for Video Object Detection on Storage trigger.
from google.cloud import videointelligence
import time
video_client = videointelligence.VideoIntelligenceServiceClient()
OUTPUT_BUCKET = 'gs://YOUR OUTPUT BUCKET NAME/'
features = [
videointelligence.Feature.OBJECT_TRACKING
@ZackAkil
ZackAkil / script.py
Last active May 12, 2021 15:41
Given a Google Cloud Storage folder location, generate a automl image classification training data label file using the folders as labels. (https://cloud.google.com/ai-platform-unified/docs/datasets/prepare-image)
from google.cloud import storage
folder_location = 'automl-ui-dataset/x-ray-dataset'
parts = folder_location.split('/')
prefix = '/'.join(parts[1:]) if len(parts) > 1 else ''
storage_client = storage.Client()
blobs = storage_client.list_blobs(parts[0], prefix=prefix)
@ZackAkil
ZackAkil / main.py
Created November 11, 2020 13:50
Google Cloud Function to Generate a tracking gif of a body part using Video Intelligence API and Storage Triggers.
import io
import numpy as np
import imageio
import cv2
from google.cloud import storage
from google.cloud import videointelligence_v1p3beta1 as videointelligence
storage_client = storage.Client()
@ZackAkil
ZackAkil / main.py
Last active November 11, 2020 17:48
Cloud Function code for Video Intelligence API pose detection on a Storage Bucket Trigger
from google.cloud import videointelligence_v1p3beta1 as videointelligence
client = videointelligence.VideoIntelligenceServiceClient()
OUTPUT_BUCKET = 'gs://YOUR OUTPUT BUCKET NAME/'
# configure person detection
config = videointelligence.types.PersonDetectionConfig(
include_bounding_boxes=True, # include bounding box round whole body