MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / automatic_speech_recognition

Function automatic_speech_recognition

bmtools/tools/hugging_tools/api.py:281–287  ·  view source on GitHub ↗
(model_id: str, audio_file_name: str)

Source from the content-addressed store, hash-verified

279 return result
280 @task
281 def automatic_speech_recognition(model_id: str, audio_file_name: str) -> str:
282 inference = InferenceApi(repo_id=model_id, token=CONFIG["huggingface"]["token"])
283 with open(f"{DIRPATH}/{INPUT_PATH}/{audio_file_name}", "rb") as f:
284 audio = f.read()
285 text = inference(data=audio, raw_response=True)
286 result = text.content
287 return str(result)
288 @task
289 def audio_to_audio(model_id: str, audio_file_name: str) -> str:
290 inference = InferenceApi(repo_id=model_id, token=CONFIG["huggingface"]["token"])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected