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 glob | |
import sys | |
import subprocess | |
from PySide2.QtWidgets import* | |
from PySide2.QtGui import* | |
from PySide2 import QtCore, QtGui | |
# initialise variables |
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
# for delay | |
import time | |
# for mouse emulation | |
from adafruit_hid.mouse import Mouse | |
# the cpx | |
import board | |
# buttons |
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 sys | |
import numpy as np | |
from keras.preprocessing import image | |
from keras.applications import resnet50 | |
# Load the Keras image database | |
model = resnet50.ResNet50() | |
# Load the picture as 224x224 (maximum size this model can cope with) | |
picture = image.load_img(sys.argv[1], target_size=(224, 224)) |
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 sys | |
import subprocess | |
def select_file(path): | |
if sys.platform == 'darwin': | |
subprocess.run(['open', '-R', path]) | |
elif sys.platform == 'linux': | |
subprocess.run(['nautilus', path]) |
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 sys | |
from PySide2.QtWidgets import* | |
from PySide2.QtGui import* | |
from PySide2 import QtCore | |
# example event handler | |
def quit_app(): | |
global application | |
print("Quit!") |
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 busio import I2C | |
from adafruit_seesaw.seesaw import Seesaw | |
from adafruit_seesaw.pwmout import PWMOut | |
from adafruit_motor import motor | |
import board | |
import time | |
# seesaw object | |
i2c = I2C(board.SCL, board.SDA) | |
seesaw = Seesaw(i2c) |
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 | |
from PIL import Image | |
import glob | |
import tkinter | |
from PIL import ImageTk | |
# process the interaction | |
def event_action(event): | |
print(repr(event)) |
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
# OS modules | |
import os | |
import shutil | |
# Image modules | |
from PIL import ImageFont | |
from PIL import Image | |
from PIL import ImageDraw | |
# create/delete our temp files folder |
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 evdev import InputDevice | |
import pigpio | |
pi = pigpio.pi() | |
tilt = 17 | |
pan = 27 | |
x = 1250 |
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 pigpio | |
# servo/gpio control | |
pi = pigpio.pi() | |
# choose your pins | |
tilt = 17 | |
pan = 27 | |
# center the servos |