[ Add, Edit ] added example part for audio transcriptions timestamp granularities, made example file loading in testing group
This commit is contained in:
@ -17,11 +17,13 @@ Future<void> main() async {
|
||||
'https://www.cbvoiceovers.com/wp-content/uploads/2017/05/Commercial-showreel.mp3',
|
||||
),
|
||||
model: "whisper-1",
|
||||
responseFormat: OpenAIAudioResponseFormat.text,
|
||||
responseFormat: OpenAIAudioResponseFormat.verbose_json,
|
||||
timestamp_granularities: [OpenAIAudioTimestampGranularity.segment],
|
||||
);
|
||||
|
||||
// print the transcription.
|
||||
print(transcription.text);
|
||||
print(transcription.segments?.map((e) => e.end));
|
||||
}
|
||||
|
||||
Future<File> getFileFromUrl(String networkUrl) async {
|
||||
|
@ -393,6 +393,11 @@ void main() async {
|
||||
});
|
||||
|
||||
test("create transcription with timestamp granularity", () async {
|
||||
final audioExampleFile = await getFileFromUrl(
|
||||
"https://www.cbvoiceovers.com/wp-content/uploads/2017/05/Commercial-showreel.mp3",
|
||||
fileExtension: "mp3",
|
||||
);
|
||||
|
||||
final transcription = await OpenAI.instance.audio.createTranscription(
|
||||
file: audioExampleFile,
|
||||
model: "whisper-1",
|
||||
|
Reference in New Issue
Block a user