def main()

in machine-learning-notebooks/main.py [0:0]


def main(protocol=None):
    print("\nPython %s\n" % sys.version)
    parser = argparse.ArgumentParser()
    parser.add_argument('--ip', help='ip address of the camera', default=utility.getWlanIp())
    parser.add_argument('--username', help='username of the camera', default='admin')
    parser.add_argument('--password', help='password of the camera', default='admin')
    args = parser.parse_args()
    ip_addr = args.ip
    username = args.username
    password = args.password
    #ip_addr = '127.0.0.1'
    hub_manager = iot.HubManager()

    with CameraClient.connect(ip_address=ip_addr, username=username, password=password) as camera_client:
        #transferring model files to device
        utility.transferdlc()

        print(camera_client.configure_preview(display_out=1))

        camera_client.toggle_preview(True)
        time.sleep(15)
        rtsp_stream_addr = "rtsp://" + ip_addr + ":8900/live"
        hub_manager.iothub_client_sample_run(rtsp_stream_addr)

        camera_client.toggle_vam(True)

        camera_client.configure_overlay("inference")

        camera_client.toggle_overlay(True)
        try:
            with camera_client.get_inferences() as results:
                print_inferences(hub_manager,results)
        except KeyboardInterrupt:
            print("Stopping")
        try:
            while(True):
                time.sleep(2)
        except KeyboardInterrupt:
            print("Stopping")

        #camera_client.toggle_overlay(False)

        camera_client.toggle_vam(False)

        camera_client.toggle_preview(False)