import whisper | |
from .voice_confidence import calc_voice_confidence_score | |
def main(file_path: str, model_size: str = "base") -> dict: | |
try: | |
# Load the Whisper model | |
whisper_model = whisper.load_model(model_size) | |
# Calculate the voice confidence score | |
result = calc_voice_confidence_score(file_path, whisper_model) | |
# Return the result as a dictionary | |
return {"voice_confidence_score": round(result, 2)} | |
except Exception as e: | |
return {"error": str(e)} | |