-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmlmodelc2hwx.m
32 lines (24 loc) · 951 Bytes
/
mlmodelc2hwx.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#import <Foundation/Foundation.h>
#import "coreml_util.h"
int main(int argc, char* argv[]) {
char* modelc_dir;
const char* chinese_v2 = "/System/Library/PrivateFrameworks/CoreHandwriting.framework/Versions/A/Resources/zh.bundle";
if (argc < 2) {
modelc_dir = (char*)chinese_v2;
} else {
modelc_dir = argv[1];
}
NSString* lastModelcDirName = [[[NSString stringWithUTF8String:modelc_dir] lastPathComponent]
stringByDeletingPathExtension];
// NSURL* compiledURL = [MLModel compileModelAtURL:testURL error:nil];
NSString* espressonet = [[NSString stringWithUTF8String:modelc_dir] stringByAppendingString:@"/model.espresso.net"];
NSLog(@"espresso model in mlmodelc directory: %@ ", espressonet);
int ret = mlmodelc_to_espresso_ir(espressonet);
if (ret)
exit(ret);
if (argc > 2)
ret = espresso_ir_hwx(lastModelcDirName, true);
else
ret = espresso_ir_hwx(lastModelcDirName, false);
return ret;
}