Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid garbled characters in the browser for text_format #2138

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 10 additions & 5 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct server_params
int32_t read_timeout = 600;
int32_t write_timeout = 600;

bool ffmpeg_converter = false;
bool ffmpeg_converter = true;
};

struct whisper_params {
Expand Down Expand Up @@ -201,16 +201,17 @@ struct whisper_print_user_data {
int progress_prev;
};

void check_ffmpeg_availibility() {
bool check_ffmpeg_availibility() {
int result = system("ffmpeg -version");

if (result == 0) {
std::cout << "ffmpeg is available." << std::endl;
return true;
} else {
// ffmpeg is not available
std::cout << "ffmpeg is not found. Please ensure that ffmpeg is installed ";
std::cout << "and that its executable is included in your system's PATH. ";
exit(0);
return false;//exit(0);
}
}

Expand Down Expand Up @@ -498,7 +499,11 @@ int main(int argc, char ** argv) {
}

if (sparams.ffmpeg_converter) {
check_ffmpeg_availibility();
if(!check_ffmpeg_availibility()){
sparams.ffmpeg_converter=false;
std::cout << "ignoring --convert option." << std::endl;
}

}
// whisper init
struct whisper_context_params cparams = whisper_context_default_params();
Expand Down Expand Up @@ -831,7 +836,7 @@ int main(int argc, char ** argv) {
if (params.response_format == text_format)
{
std::string results = output_str(ctx, params, pcmf32s);
res.set_content(results.c_str(), "text/html");
res.set_content(results.c_str(), "text/html; charset=utf-8");
}
else if (params.response_format == srt_format)
{
Expand Down