MCPcopy
hub / github.com/modelscope/FunASR / transcribe

Function transcribe

examples/openai_api/smoke_test.py:62–75  ·  view source on GitHub ↗
(base_url: str, audio_path: Path, model: str, response_format: str, timeout: float)

Source from the content-addressed store, hash-verified

60
61
62def transcribe(base_url: str, audio_path: Path, model: str, response_format: str, timeout: float) -> dict:
63 body, boundary = multipart_body(audio_path, model, response_format)
64 request = urllib.request.Request(
65 f"{base_url}/v1/audio/transcriptions",
66 data=body,
67 method="POST",
68 headers={
69 "Accept": "application/json",
70 "Content-Type": f"multipart/form-data; boundary={boundary}",
71 "Content-Length": str(len(body)),
72 },
73 )
74 with urllib.request.urlopen(request, timeout=timeout) as response:
75 return json.loads(response.read().decode("utf-8"))
76
77
78def print_json(title: str, payload: dict) -> None:

Callers 1

mainFunction · 0.70

Calls 3

multipart_bodyFunction · 0.70
decodeMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…