Skip to content

Use the CoreML framework in iOS 11+ with Appcelerator Titanium

License

Notifications You must be signed in to change notification settings

chrisbowley/titanium-coreml

 
 

Repository files navigation

iOS 11+ CoreML in Titanium

Use the native iOS 11+ "CoreML" framework in Axway Titanium.

Requirements

  • Titanium SDK 6.2.0 and later
  • iOS 11 and later
  • Compiled CoreML models (xcrun coremlcompiler compile path/to/model.mlmodel /path/to/output)

API's

createRealtimeRecognitionView(args)

  • model (String - Required)

Methods

  • startRecognition()
  • stopRecognition()
  • isRecognizing() (Boolean)

Events

  • classification (Event.classifications)

isSupported() (Boolean)

Example

var CoreML = require('ti.coreml');

var recognitionView = CoreML.createRealtimeRecognitionView({
    top: 40,
    height: 300,
    model: 'Inceptionv3.mlmodelc'
});

recognitionView.addEventListener('classification', function(e) {
    Ti.API.info(e);
});

var win = Ti.UI.createWindow({
    backgroundColor: '#fff'
});

win.add(recognitionView);

var triggerButton = Ti.UI.createButton({
    bottom: 40,
    title: 'Start Real-Time Recognition'
});

triggerButton.addEventListener('click', function() {
    recognitionView.startRecognition();
});

win.add(triggerButton);
win.open();

Build

cd iphone
appc ti build -p ios --build-only

Legal

This module is Copyright (c) 2017-Present by Axway Appcelerator, Inc. All Rights Reserved. Usage of this module is subject to the Terms of Service agreement with Appcelerator, Inc.

About

Use the CoreML framework in iOS 11+ with Appcelerator Titanium

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 94.0%
  • JavaScript 6.0%