@@ -34,14 +34,14 @@ using tensorflow::int32;
3434// input the model expects. If you train your own model, or use something
3535// other than GoogLeNet you'll need to update these.
3636TF_DEFINE_string (image,
37- " tensorflow/examples/label_image/ data/grace_hopper.jpg" ,
37+ " data/grace_hopper.jpg" ,
3838 " The image to classify (JPEG or PNG)." );
3939TF_DEFINE_string (graph,
40- " tensorflow/examples/label_image/ data/googlenet_graph.pb" ,
40+ " data/googlenet_graph.pb" ,
4141 " The location of the GraphDef file containing the protobuf"
4242 " definition of the network." );
4343TF_DEFINE_string (labels,
44- " tensorflow/examples/label_image/ data/googlenet_labels.txt" ,
44+ " data/googlenet_labels.txt" ,
4545 " A text file containing the labels of all the categories, one"
4646 " per line." );
4747TF_DEFINE_int32 (input_width, 224 , " Width of the image the network expects." );
@@ -216,14 +216,14 @@ Status CheckTopLabel(const std::vector<Tensor>& outputs, int expected,
216216 return Status::OK ();
217217}
218218
219- int main ( int argc, char * argv[] ) {
219+ int runTests ( ) {
220220 // We need to call this to set up global state for TensorFlow.
221- tensorflow::port::InitMain (argv[0 ], &argc, &argv);
222- Status s = tensorflow::ParseCommandLineFlags (&argc, argv);
223- if (!s.ok ()) {
224- LOG (ERROR ) << " Error parsing command line flags: " << s.ToString ();
225- return -1 ;
226- }
221+ // tensorflow::port::InitMain(argv[0], &argc, &argv);
222+ // Status s = tensorflow::ParseCommandLineFlags(&argc, argv);
223+ // if (!s.ok()) {
224+ // LOG(ERROR) << "Error parsing command line flags: " << s.ToString();
225+ // return -1;
226+ // }
227227
228228 // First we load and initialize the model.
229229 std::unique_ptr<tensorflow::Session> session;
@@ -285,8 +285,13 @@ int main(int argc, char* argv[]) {
285285
286286using namespace v8 ;
287287
288+ NAN_METHOD (RunTest) {
289+ printf (" \n Running Test\n " );
290+ runTests ();
291+ }
292+
288293NAN_METHOD (Version) {
289- printf (" %s" , TF_VERSION_STRING );
294+ printf (" %s\n " , TF_VERSION_STRING );
290295}
291296
292297NAN_METHOD (Print) {
@@ -299,6 +304,9 @@ NAN_MODULE_INIT(Init) {
299304
300305 Nan::Set (target, Nan::New (" version" ).ToLocalChecked (),
301306 Nan::GetFunction (Nan::New<FunctionTemplate>(Version)).ToLocalChecked ());
307+
308+ Nan::Set (target, Nan::New (" test" ).ToLocalChecked (),
309+ Nan::GetFunction (Nan::New<FunctionTemplate>(RunTest)).ToLocalChecked ());
302310}
303311
304312NODE_MODULE (myaddon, Init);
0 commit comments