This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
""" | |
This histogram will be used to charac- terize the color of the flower petals, | |
which is a good starting point for classifying the species of a flower | |
""" | |
class RGBHistogram: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import subprocess | |
import zipfile | |
import sys | |
import getopt | |
import shutil | |
import datetime | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --rm -it -e AWS_DEFAULT_REGION="$AWS_DEFAULT_REGION" -e AWS_ACCESS_KEY_ID="$AWS_ACCESS_KEY_ID" -e AWS_SECRET_ACCESS_KEY="$AWS_SECRET_ACCESS_KEY" -v "$PWD":/var/task lambci/lambda:build-python3.6 bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create file on RPI, copy contents to a .sh file and execute | |
# See Gist | |
# https://gist.github.com/dschep/24aa61672a2092246eaca2824400d37f | |
# setup | |
echo "Update RPI" | |
sudo apt-get -y update | |
sudo apt-get -y install build-essential tk-dev libncurses5-dev libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev | |
# install python 3.6.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# script or instructions to install opencv 4.1.0 | |
# on raspberry pi with buster version of raspbian | |
sudo apt-get -y update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install screen | |
sudo apt-get -y install htop | |
# ------------------- | |
# run screen command to put window in background |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import pandas as pd | |
# URL for the web service | |
scoring_uri = 'http://SOME ID.centralus.azurecontainer.io/score' | |
# If the service is authenticated, set the key or token | |
key = 'SOME KEY' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp = client.sign_up( | |
ClientId = os.getenv('CLIENT_ID'), | |
SecretHash=get_secret_hash(email, os.getenv('CLIENT_ID'), os.getenv('CLIENT_SECRET')), | |
Username=email, | |
Password=password, | |
UserAttributes=[ | |
{ | |
"Name": "custom:favorite_band", | |
"Value": favorite_band | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp = client.confirm_sign_up( | |
ClientId = os.getenv('CLIENT_ID'), | |
SecretHash=get_secret_hash(email, os.getenv('CLIENT_ID'), os.getenv('CLIENT_SECRET')), | |
Username=email, | |
ConfirmationCode=code, | |
ForceAliasCreation=False | |
) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resp=client.initiate_auth( | |
ClientId=os.getenv('CLIENT_ID'), | |
AuthFlow='USER_PASSWORD_AUTH', | |
AuthParameters={ | |
'USERNAME': email, | |
'SECRET_HASH': get_secret_hash(email, os.getenv('CLIENT_ID'), os.getenv('CLIENT_SECRET')), | |
'PASSWORD': password, | |
}) | |
return resp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import json | |
from jose import jwt | |
logger = logging.getLogger() | |
logger.setLevel(logging.DEBUG) | |
def lambda_handler(event, context): | |
logger.debug("Add Note Lambda") |