import whisper | |
from .compute_vps_score import compute_vps_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 = compute_vps_score(file_path, whisper_model) | |
# Return the result as a dictionary | |
return { | |
"VPS": result["VPS"] | |
# "SRS": result["SRS"], | |
# "PAS": result["PAS"], | |
# "NPP": result["NPP"], | |
# "AFW": result["AFW"], | |
# "RCS": result["RCS"], | |
# "STR": result["STR"], | |
# "STW": result["STW"] | |
} | |
except Exception as e: | |
return {"error": str(e)} | |