MCPcopy
hub / github.com/llmware-ai/llmware / test_whisper_cpp

Function test_whisper_cpp

tests/models/test_whisper_cpp_model_load.py:21–53  ·  view source on GitHub ↗

Execute a basic inference on Voice-to-Text model passing a file_path string

()

Source from the content-addressed store, hash-verified

19
20
21def test_whisper_cpp():
22
23 """ Execute a basic inference on Voice-to-Text model passing a file_path string """
24
25 voice_samples = Setup().load_voice_sample_files(small_only=True, over_write=True)
26
27 example = "famous_quotes"
28
29 fp = os.path.join(voice_samples,example)
30
31 files = os.listdir(fp)
32
33 # these are the two key lines
34 whisper_base_english = "whisper-cpp-base-english"
35
36 model = ModelCatalog().load_model(whisper_base_english)
37
38 for f in files:
39
40 if f.endswith(".wav"):
41
42 prompt = os.path.join(fp,f)
43
44 print(f"\n\nPROCESSING: prompt = {prompt}")
45
46 response = model.inference(prompt)
47
48 print("\nllm response: ", response["llm_response"])
49 print("usage: ", response["usage"])
50
51 assert response is not None
52
53 return 0
54
55
56

Callers

nothing calls this directly

Calls 5

SetupClass · 0.90
ModelCatalogClass · 0.90
load_modelMethod · 0.45
inferenceMethod · 0.45

Tested by

no test coverage detected