File size: 1,267 Bytes
eefb74d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""
Test script to verify the improved whisper error handling
"""
import asyncio
import sys
import os

# Add project root to Python path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))

async def test_whisper_error_handling():
    """Test the improved error handling in whisper_llm.py"""
    try:
        from app.utils.whisper_llm import analyze
        print("βœ… Whisper analyze function imported successfully")
        
        # Test the transcription result handling
        from faster_whisper import WhisperModel
        print("βœ… Faster-Whisper imported successfully")
        
        # Test model initialization
        model = WhisperModel("base", device="cpu", compute_type="int8")
        print("βœ… Whisper model initialized successfully")
        
        print("βœ… All whisper components working correctly!")
        print("βœ… Error handling improvements applied successfully!")
        return True
        
    except ImportError as e:
        print(f"❌ Import error: {e}")
        return False
    except Exception as e:
        print(f"❌ Unexpected error: {e}")
        return False

if __name__ == "__main__":
    success = asyncio.run(test_whisper_error_handling())
    sys.exit(0 if success else 1)