Skip to content

Instantly share code, notes, and snippets.

View metal3d's full-sized avatar
🤖
Electrifying my brain

Patrice Ferlet metal3d

🤖
Electrifying my brain
View GitHub Profile
@metal3d
metal3d / make_prediction.py
Last active November 28, 2018 12:33
Keras make prediction on image sequence
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()
@metal3d
metal3d / function.yaml
Created September 10, 2018 11:47
Simple Keras model loader and prediction handler for Nuclio
apiVersion: "nuclio.io/v1beta1"
kind: "Function"
spec:
runtime: "python:3.6"
handler: main:handler
minReplicas: 1
maxReplicas: 1
build:
baseImage: python:3.6-jessie
@metal3d
metal3d / dlblender
Created September 8, 2018 16:17
Download latest Blender builds
#!/bin/env python3
# -*- encoding: utf8 -*-
"""
Download latest build for Blender 2.7x and 2.8x
How to use:
- get that source code and name it "dlblender"
- change vars INSTALL_PATH and LINK_PATH is you want
- INSTALL_PATH is where will reside new and old version of blender.
I'm using hidden path "~/.blender"
@metal3d
metal3d / predictor.py
Created June 7, 2018 09:16
Sagmaker prediction
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)
@metal3d
metal3d / estimator.py
Last active June 7, 2018 09:45
Sagemaker estimator
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// 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"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@metal3d
metal3d / goswitch installation
Created November 19, 2017 16:44
Install script for goswitch
curl -sSL $(curl -s https://api.github.com/repos/metal3d/goswitch/releases/latest | \
grep tarball | cut -d '"' -f 4) | \
tar -zxf - --strip-components=1 -C ~/.local/bin */goswitch
@metal3d
metal3d / OWNERS
Last active March 24, 2017 23:18
Kubernetes Incubator Proposal - Argoos
Patrice FERLET aka Metal3d <metal3d@gmail.com> <patrice.ferlet@smile.fr>