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)}") | |