def main():
# Get Model:
model_file = open('Data/Model/model.json', 'r')
model = model_file.read()
model_file.close()
model = model_from_json(model)
model.load_weights("Data/Model/weights.h5")
# Get camera:
cap = cv2.VideoCapture(0)
# Open game in browser:
open_game(browser='chrome', url='http://apps.thecodepost.org/trex/trex.html')
while 1:
# Get image from camera:
ret, img = cap.read()
Y = predict(model, img)
if Y == 0:
release()
elif Y == 1:
press()
cap.release()
评论列表
文章目录