This file contains hidden or 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 | |
from keras.applications import ResNet50 | |
from keras.applications import imagenet_utils | |
from keras.preprocessing.image import img_to_array | |
model = ResNet50(weights='imagenet') | |
camera = cv2.VideoCapture(0) | |
# If possible control the FPS to constrain the labels appearances |
This file contains hidden or 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
# Install nvidia-drivers | |
add-apt-repository -y ppa:graphics-drivers/ppa && \ | |
apt-get update && \ | |
apt-get install -y nvidia-415 && \ | |
# Install the latest docker-ce | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - && \ | |
apt-key fingerprint 0EBFCD88 && \ | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && \ | |
apt-get update && \ | |
apt-get install -y docker-ce && \ |
This file contains hidden or 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
# get mp3 stdout output, pipe it to sox to remove beginning and end silence, and force specific rate sample and monochannel | |
gtts-cli "Hello World" | sox -t mp3 - -r 8000 -c 1 out.wav silence 1 0.1 1% reverse silence 1 0.1 1% reverse |
This file contains hidden or 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
## summary.csv and input_postconnect.csv are dummy files of example. | |
# Filter examples | |
## print entire row | |
awk -F';' '{ if( ($3=="") && (($5~"human")||($5~"machine"))) { print } }' summary.csv | |
awk -F';' '{ if( ($3~"human") && ($5!~"human") && ($5!="")) { print } }' summary.csv | |
## print specific column $1 | |
awk -F';' '{ if( ($3~"human") && ($5!~"human") && ($5!="")) { print $1 } }' summary.csv |
This file contains hidden or 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
# | |
# Generic example | |
# | |
from flask import Flask, json, request, Response | |
import helpers | |
app = Flask(__name__) | |
@app.route('/predict', methods = ['POST']) | |
def api_predict(): |
NewerOlder