This commit is contained in:
Roy Shilkrot 2023-10-29 01:45:50 -04:00
parent 030bb819c3
commit ad182f4593

View File

@ -78,9 +78,11 @@ struct whisper_context *init_whisper_context(const std::string &model_path)
#ifdef _WIN32
// convert model path UTF8 to wstring (wchar_t) for whisper
int count = MultiByteToWideChar(CP_UTF8, 0, model_path.c_str(), (int)model_path.length(), NULL, 0);
int count = MultiByteToWideChar(CP_UTF8, 0, model_path.c_str(), (int)model_path.length(),
NULL, 0);
std::wstring model_path_ws(count, 0);
MultiByteToWideChar(CP_UTF8, 0, model_path.c_str(), (int)model_path.length(), &model_path_ws[0], count);
MultiByteToWideChar(CP_UTF8, 0, model_path.c_str(), (int)model_path.length(),
&model_path_ws[0], count);
// Read model into buffer
std::ifstream modelFile(model_path_ws, std::ios::binary);