Ejemplo n.º 1
0
def test_e2e():
    with open("tests/data/lucier_golden.json") as f:
        golden = json.load(f)
    with open("tests/data/lucier.txt") as f:
        transcript = f.read()
    ret = lm_transcribe("tests/data/lucier.mp3", transcript, "PROTO_LANGDIR",
                        "data/nnet_a_gpu_online")

    score = alignment_score(golden['words'], ret['words'])
    assert_greater(score['correct'], 0.85)
    assert_less(score['error'], 0.35)
Ejemplo n.º 2
0
def test_e2e():
	with open("tests/data/lucier_golden.json") as f:
		golden = json.load(f)
	with open("tests/data/lucier.txt") as f:
		transcript = f.read()
	ret = lm_transcribe(
		"tests/data/lucier.mp3",
		transcript,
		"PROTO_LANGDIR",
		"data/nnet_a_gpu_online")
	
	score = alignment_score(golden['words'], ret['words'])
	assert_greater(score['correct'], 0.85)
	assert_less(score['error'], 0.35)
Ejemplo n.º 3
0
def transcribe():
    transcript = request.form['transcript']

    audio = request.files['audio']
    _, extension = os.path.splitext(audio.filename)
    audio_file = tempfile.NamedTemporaryFile(suffix=extension)
    audio.save(audio_file)

    proto_langdir = app.config['proto_langdir']
    nnet_dir = app.config['nnet_dir']

    aligned = lm_transcribe(audio_file.name, transcript,
        proto_langdir, nnet_dir)
    return jsonify(transcript=aligned)