File size: 746 Bytes
8ad2ab3 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import whisper
from .compute_vcs import analyze_voice_quality
def main(file_path: str, model_size: str = "base") -> dict:
try:
whisper_model = whisper.load_model(model_size)
results = analyze_voice_quality(file_path, whisper_model)
# Structure response
response = {
"Voice Clarity Sore": round(results['VCS'], 2)
# "Articulation": round(results['components']['articulation'],2),
# "Enunciation": round(results['components']['enunciation'],2),
# "Speech Pause Control": round(results['components']['speech_pause_control'],2),
}
return response
except Exception as e:
raise RuntimeError(f"Error during analysis: {str(e)}")
|