#include"utilities.hpp"

int const_getFileNum()
{
	return 5;
    FILE* crs = popen("`pwd`/bip_example/resources/Signs", "r"); // execute the shell command 

    char result[4] = "0";

    fread(result, sizeof(char), sizeof(result), crs);

    if (NULL != crs)
    {
        fclose(crs);
        crs = NULL;
    }

    int num = atoi(result);
    return num;
}


int deepLearn(int i){
	char buffer [50];
	sprintf (buffer, "%d.png", i);
	stringstream tmp;
	tmp<<"python3 `pwd`/bip_example/resources/ext-cpp/Inference.py `pwd`/bip_example/resources/ext-cpp/yolox_s.onnx `pwd`/bip_example/resources/Signs/"<<i<<".png > system.txt";
	//tmp<<"python ./ext-cpp/Inference.py ./ext-cpp/yolox_s.onnx > system.txt";
	string execCmd = tmp.str();
	int a = system(execCmd.c_str());
	FILE *fp;
	int buff;

	fp = fopen("system.txt", "r");
	int result = fscanf(fp, "%d", &buff);
	printf("%d\n",result);
	fclose(fp);

	if(result == EOF)
		return -1;

	return buff;

}




