Skip to content

Conversation

@MrSwitch
Copy link
Contributor

@MrSwitch MrSwitch commented Feb 18, 2025

Fixes #120

Returns the output formats in a desired format. This is particularly useful to capture a json response.

aka, now..

   const transcription = await nodewhisper(audioPath, {
        modelName: 'base.en',
        responseFormat: 'json'
    }); // returns JSON object

previously....

import fs from 'fs';
import path from 'path';
...
await nodewhisper(audioPath, {
        modelName: 'base.en',
        whisperOptions: {
            outputInJson: true
        }
 });
const response = fs.readFileSync(`${path.join(path.dirname(audioPath), path.basename(audioPath, path.extname(audioPath)))}.wav.json`, 'utf8');
const transcription = JSON.parse(response);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't get JSON file

1 participant