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
# -*- encoding: utf-8 -*- | |
""" threadpool module, export ThreadPool class that is a non blocking | |
Thread Queue. Most important is that ThreadPool.add_task runs | |
asychroniousally. This method doesn't block process. | |
Example: | |
p = ThreadPool(2) | |
p.add_task(f1, arg1, arg2, test=False) | |
p.add_task(f1, arg2, arg3, test=False) | |
p.add_task(f1, arg4, arg5, test=True) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
// Proposes to draw gonum plot on Jupyter using | |
// the fantastic lgo kernel | |
package jplot | |
// You may save that file in $GOPATH/src/jplot/jplot.go | |
import ( | |
"bytes" | |
"github.com/yunabe/lgo/core" |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
from sagemaker.predictor import RealTimePredictor | |
from sagemaker.predictor import json_serializer | |
# get the name in SageMaker interface and put it there | |
endpoint = 'name of your endpoint' | |
# you can use other serializer, or none if you are able | |
# to get data in binary format | |
predictor = RealTimePredictor(endpoint, serializer=json_serializer) |
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 sagemaker as sage | |
import boto3 | |
from sagemaker import get_execution_role | |
role = get_execution_role() | |
sess = sage.Session() | |
account = sess.boto_session.client('sts').get_caller_identity()['Account'] | |
region = sess.boto_session.region_name # or setup the region by hand |
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
apiVersion: "nuclio.io/v1beta1" | |
kind: "Function" | |
spec: | |
runtime: "python:3.6" | |
handler: main:handler | |
minReplicas: 1 | |
maxReplicas: 1 | |
build: | |
baseImage: python:3.6-jessie |
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
from IPython.display import HTML, display | |
import cv2 as cv | |
import os | |
import matplotlib.pyplot as plt | |
def make_prediction(model, movie, nframe, classes, shape=(224, 224), nchan=3): | |
video = cv.VideoCapture(movie) | |
frames = [] | |
while True: | |
grabbed, frame = video.read() |
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 tensorflow as tf | |
import numpy as np | |
from IPython.display import clear_output, Image, display, HTML | |
def strip_consts(graph_def, max_const_size=32): | |
"""Strip large constant values from graph_def.""" | |
strip_def = tf.GraphDef() | |
for n0 in graph_def.node: | |
n = strip_def.node.add() | |
n.MergeFrom(n0) |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.