Install pi, then camera, then edit the /boot/config.txt
Add disable_camera_led=1 to the bottom of the file and rebooting.
sudo apt-get install xscreensaver
xscreensaver
Then disable screen saver in the “Display Mode” tab.
| import time | |
| import board | |
| import neopixel | |
| # Mouse stuff | |
| import usb_hid | |
| from adafruit_hid.mouse import Mouse | |
| mouse = Mouse(usb_hid.devices) | |
| # Annoying config | |
| jump_distance = 75 # jump 75 pixels | |
| delay_time = 60 # every 60 seconds |
| # Generate your Android production bundle (just code no assets) | |
| $ yarn react-native bundle --platform android --dev false --entry-file index.js --bundle-output ./index.android.bundle | |
| # Generate your iOS production bundle (just code no assets) | |
| $ yarn react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ./index.ios.bundle |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet"> | |
| <style> | |
| .cert, .cert * { | |
| font-family: 'Open Sans', sans-serif; | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; |
| <AILabPhoto | |
| // Provide TFJS Model and info | |
| modelInfo={{ | |
| model: myModel, | |
| objectDetection: true, | |
| labels: ['dog', 'cat'], | |
| threshold: 0.4, | |
| max: 20, | |
| IOU: 0.5 | |
| }} |
| // TensorFlow required | |
| import * as tf from '@tensorflow/tfjs' | |
| import { setWasmPath } from '@tensorflow/tfjs-backend-wasm' | |
| // Default path without setWasmPath is /static/js/tfjs-backend-wasm.wasm | |
| setWasmPath('/tfjs-backend-wasm.wasm') | |
| // We can now force a WASM backend and print it for proof! | |
| tf.setBackend('wasm').then(console.log('The Backend is', tf.getBackend())) |
| "scripts": { | |
| "wasm": "cp node_modules/@tensorflow/tfjs-backend-wasm/dist/tfjs-backend-wasm.wasm ./public", | |
| "winwasm": "PowerShell -Command cp node_modules/@tensorflow/tfjs-backend-wasm/dist/tfjs-backend-wasm.wasm ./public -Force", | |
| "start": "yarn wasm && react-scripts start", | |
| "build": "yarn wasm && react-scripts build", | |
| "test": "react-scripts test", | |
| "eject": "react-scripts eject" | |
| }, |
| const path = require('path') | |
| module.exports = function override(config, env) { | |
| config.module.rules.push({ | |
| test: /\.wasm$/i, | |
| type: 'javascript/auto', | |
| use: [{ loader: 'file-loader' }] | |
| }) | |
| return config |
| // https://www.cs.toronto.edu/~kriz/cifar.html | |
| import * as DogsNCats from "dogs-n-cats" | |
| // Creates a 1,000 dog and 1,000 cat images in memory | |
| const DC = await DogsNCats.load() | |
| // 4/5 Train/Test | |
| DC.training.length // 1600 | |
| DC.test.length // 400 |
| // Gimme that image | |
| const img = document.getElementById('questionable_img') | |
| // Classify the image | |
| const predictions = await model.classify(img) | |
| // Share results | |
| console.log('Predictions: ', predictions) |