forked from olrea/openai-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11-audio.cpp
More file actions
30 lines (25 loc) · 711 Bytes
/
Copy path11-audio.cpp
File metadata and controls
30 lines (25 loc) · 711 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "openai.hpp"
#include <iostream>
int main() {
openai::start();
{
// Change "audio.mp3" to your audio file location
auto transcription = openai::audio().transcribe(R"(
{
"file": "audio.mp3",
"model": "whisper-1"
}
)"_json);
std::cout << "Response is:\n" << transcription.dump(2) << '\n';
}
{
// Change "german.m4a" to your audio file location
auto translation = openai::audio().translate(R"(
{
"file": "german.m4a",
"model": "whisper-1"
}
)"_json);
std::cout << "Response is:\n" << translation.dump(2) << '\n';
}
}