whisper.cpp icon indicating copy to clipboard operation
whisper.cpp copied to clipboard

Provide option for creating JSON output

Open tuxpoldo opened this issue 2 years ago • 2 comments
trafficstars

In order to allow other applications to read the result, it would be a nice idea to have also the option to produce a JSON file:

Sample:

{
	"systeminfo": "AVX = 0 | AVX2 = 0 | AVX512 = 0 | FMA = 0 | NEON = 1 | ARM_FMA = 1 | F16C = 0 | FP16_VA = 1 | WASM_SIMD = 0 | BLAS = 1 | SSE3 = 0 | VSX = 0 | ",
	"model": {
		"type": "large",
		"multilingual": true,
		"vocab": 51865,
		"audio": {
			"ctx": 1500,
			"state": 1280,
			"head": 20,
			"layer": 32
		},
		"text": {
			"ctx": 448,
			"state": 1280,
			"head": 20,
			"leyer": 32
		},
		"mels": 80,
		"f16": 1
	},
	"params": {
		"model": "models/ggml-large.bin",
		"language": "auto",
		"translate": true
	},
	"result": {
		"language": "de"
	},
	"transcription": [
		{
			"timestanps": {
				"from": "00:00:00,000",
				"to": "00:00:02,000"
			},
			"offsets": {
				"from": 0,
				"to": 2000
			},
			"text": " Hello everyone."
		},
		{
			"timestanps": {
				"from": "00:00:02,000",
				"to": "00:00:08,000"
			},
			"offsets": {
				"from": 2000,
				"to": 8000
			},
			"text": " Here is a typical caller who only tells nonsense."
		},
		{
			"timestanps": {
				"from": "00:00:08,000",
				"to": "00:00:17,000"
			},
			"offsets": {
				"from": 8000,
				"to": 17000
			},
			"text": " Callers who always call and nag and nag and make a lot of stupid statements."
		},
		{
			"timestanps": {
				"from": "00:00:17,000",
				"to": "00:00:20,000"
			},
			"offsets": {
				"from": 17000,
				"to": 20000
			},
			"text": " Goodbye."
		}
	]
}

tuxpoldo avatar Mar 15 '23 12:03 tuxpoldo

there is merge ready waiting with this feature. Search for JSON in Pull Requests

mirozahorak avatar Mar 15 '23 13:03 mirozahorak

@mirozahorak : And guess who made the pull request? ;-) I just try to respect the principle that every code change should be linked to an issue that describes the change.

tuxpoldo avatar Mar 17 '23 09:03 tuxpoldo

Only found the option through a search. For some reason it is not in the main README: https://github.com/ggerganov/whisper.cpp/blob/master/README.md

but only in examples/main README: https://github.com/ggerganov/whisper.cpp/blob/master/examples/main/README.md

Sogl avatar Sep 18 '23 11:09 Sogl