Skip to content

Commit 1a4a739

Browse files
modify
1 parent b967840 commit 1a4a739

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

examples/11-audio.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ int main() {
99
// Change "audio.mp3" to your audio file location
1010
auto transcription = openai::audio().transcribe(R"(
1111
{
12-
"file": "audio.wav",
12+
"file": "audio.mp3",
1313
"model": "whisper-1"
1414
}
1515
)"_json);
1616
std::cout << "Response is:\n" << transcription.dump(2) << '\n';
1717
}
18-
/*
18+
1919
{
2020
// Change "german.m4a" to your audio file location
2121
auto translation = openai::audio().translate(R"(
@@ -26,6 +26,6 @@ int main() {
2626
)"_json);
2727
std::cout << "Response is:\n" << translation.dump(2) << '\n';
2828
}
29-
*/
29+
3030
}
3131

include/openai/openai.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,18 @@ class Session {
7474

7575
~Session() {
7676
curl_easy_cleanup(curl_);
77-
// curl_global_cleanup();
77+
curl_global_cleanup();
7878
if (mime_form_ != nullptr) {
7979
curl_mime_free(mime_form_);
8080
}
8181
}
8282

8383
void initCurl() {
84-
// curl_global_init(CURL_GLOBAL_ALL);
84+
curl_global_init(CURL_GLOBAL_ALL);
8585
curl_ = curl_easy_init();
8686
if (curl_ == nullptr) {
8787
throw std::runtime_error("curl cannot initialize"); // here we throw it shouldn't happen
8888
}
89-
// 设置这个防止多线程调用崩溃
9089
curl_easy_setopt(curl_, CURLOPT_NOSIGNAL, 1);
9190
}
9291

0 commit comments

Comments
 (0)