Spaces:
Running
Running
| 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!") | |