Execute a basic inference on Voice-to-Text model passing a file_path string
()
| 19 | |
| 20 | |
| 21 | def 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 |
nothing calls this directly
no test coverage detected