mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-12-24 13:28:13 +08:00
fix Windows text encoding issue causing infinite loop
This commit is contained in:
@@ -14,6 +14,9 @@
|
||||
|
||||
PROJECT(infer_demo C CXX)
|
||||
CMAKE_MINIMUM_REQUIRED (VERSION 3.10)
|
||||
if(MSVC)
|
||||
add_definitions(/utf-8)
|
||||
endif()
|
||||
|
||||
option(FASTDEPLOY_INSTALL_DIR "Path of downloaded fastdeploy sdk.")
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@
|
||||
|
||||
#include "fastdeploy/text.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
using namespace paddlenlp;
|
||||
|
||||
#ifdef WIN32
|
||||
@@ -77,6 +81,9 @@ int main(int argc, char* argv[]) {
|
||||
predictor.Predict({"2月8日上午北京冬奥会自由式滑雪女子大跳台决赛中中国选手谷"
|
||||
"爱凌以188.25分获得金牌!"},
|
||||
&results);
|
||||
#ifdef WIN32
|
||||
SetConsoleOutputCP(CP_UTF8);
|
||||
#endif
|
||||
std::cout << results << std::endl;
|
||||
results.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user