-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_transcription_fix.py
More file actions
44 lines (36 loc) · 1.34 KB
/
test_transcription_fix.py
File metadata and controls
44 lines (36 loc) · 1.34 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python3
"""
Quick test to verify Whisper transcription with existing recording
"""
import asyncio
import sys
from pathlib import Path
from whisper_service import WhisperService
async def test_transcription():
# Find the most recent recording
recordings_dir = Path("/tmp/voice_kiosk_recordings")
recordings = list(recordings_dir.glob("recording_*.wav"))
if not recordings:
print("❌ No recordings found in /tmp/voice_kiosk_recordings")
return False
# Sort by modification time and get the most recent
latest_recording = max(recordings, key=lambda p: p.stat().st_mtime)
print(f"Testing transcription with: {latest_recording}")
print(f"File size: {latest_recording.stat().st_size} bytes")
# Initialize Whisper
print("\nInitializing Whisper...")
whisper = WhisperService(model_name="tiny.en", device="cpu", compute_type="int8")
# Transcribe
print("Transcribing...")
result = await whisper.transcribe(str(latest_recording))
if result:
print(f"\n✅ SUCCESS!")
print(f"Transcription: '{result}'")
print(f"Length: {len(result)} characters")
return True
else:
print(f"\n❌ FAILED - Empty transcription")
return False
if __name__ == "__main__":
success = asyncio.run(test_transcription())
sys.exit(0 if success else 1)