import whisper | |
from .compute_fluency import compute_fluency_score | |
def main(file_path: str, model_size: str = "base", filler_count = None) -> dict: | |
try: | |
whisper_model = whisper.load_model(model_size) | |
results = compute_fluency_score(file_path, whisper_model, filler_count) | |
# Structure response | |
response = { | |
"fluency_score": round(results['fluency_score'], 2) | |
# "insight": results["insight"], | |
# "SRS": round(results["SRS"], 2), | |
# "PAS": round(results["PAS"], 2), | |
# "transcript": results["transcript"] | |
} | |
return response | |
except Exception as e: | |
raise RuntimeError(f"Error during analysis: {str(e)}") | |