Commit b705d233 authored by mayong's avatar mayong
Browse files

update files.

parent 5cacbb67
...@@ -13,5 +13,5 @@ class Model { ...@@ -13,5 +13,5 @@ class Model {
virtual std::string rescoring() = 0; virtual std::string rescoring() = 0;
}; };
Model *create_model(const char *path); Model *create_model(const char *path,int nThread=0);
#endif #endif
#include "precomp.h" #include "precomp.h"
Model *create_model(const char *path) Model *create_model(const char *path,int nThread)
{ {
Model *mm; Model *mm;
mm = new paraformer::ModelImp(path); mm = new paraformer::ModelImp(path, nThread);
return mm; return mm;
} }
...@@ -18,15 +18,17 @@ int main(int argc, char *argv[]) ...@@ -18,15 +18,17 @@ int main(int argc, char *argv[])
printf("Usage: %s /path/to/model_dir /path/to/wav/file", argv[0]); printf("Usage: %s /path/to/model_dir /path/to/wav/file", argv[0]);
exit(-1); exit(-1);
} }
struct timeval start, end;
Model* mm = create_model(argv[1]); gettimeofday(&start, NULL);
int nThreadNum = 8;
Model* mm = create_model(argv[1], nThreadNum);
if (!mm) if (!mm)
{ {
printf("Cannot load ASR Model from: %s, there must be files model.onnx and vocab.txt", argv[1]); printf("Cannot load ASR Model from: %s, there must be files model.onnx and vocab.txt", argv[1]);
exit(-1); exit(-1);
} }
struct timeval start, end;
Audio audio(0); Audio audio(0);
if (!audio.loadwav(argv[2])) if (!audio.loadwav(argv[2]))
{ {
...@@ -34,7 +36,7 @@ int main(int argc, char *argv[]) ...@@ -34,7 +36,7 @@ int main(int argc, char *argv[])
return -1; return -1;
} }
audio.disp(); audio.disp();
gettimeofday(&start, NULL);
gettimeofday(&end, NULL); gettimeofday(&end, NULL);
long seconds = (end.tv_sec - start.tv_sec); long seconds = (end.tv_sec - start.tv_sec);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment