Spaces:
Running
Running
File size: 1,012 Bytes
a159b10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | from model.speech_recognizer import SpeechRecognizer
import sys
import os
def test_model_initialization():
print("Testing model initialization...")
recognizer = SpeechRecognizer(model_size="tiny")
assert recognizer.model is not None
print("✓ Model initialization test passed")
def test_transcription_with_file():
if len(sys.argv) > 1 and os.path.exists(sys.argv[1]):
audio_file = sys.argv[1]
print(f"\nTesting transcription with: {audio_file}")
recognizer = SpeechRecognizer(model_size="tiny")
text = recognizer.transcribe_audio(audio_file)
print(f"Transcribed text: '{text}'")
print("✓ Transcription test passed")
else:
print("\n⚠ Skipping transcription test (no audio file provided)")
print(" To test with audio: uv run python test_speech.py <path-to-audio.wav>")
if __name__ == "__main__":
test_model_initialization()
test_transcription_with_file()
print("\n✅ Speech recognition tests complete!")
|