in demo_app/demo_app.py [0:0]
def cc_audio_upload(file: str, transcription_method: str):
if file is None:
gr.Warning(
"Please select or upload an audio file, then click 'Process File'."
)
return ("", "", {})
# Get response from the API
with open(file, "rb") as f:
payload = {"method": transcription_method}
files = {
"audio": (file, f, "audio/wav"),
"json": ("payload.json", json.dumps(payload), "application/json"),
}
request_outputs = send_request(
route="call_center_audio_analysis",
files=files,
force_json_content_type=True, # JSON gradio block requires this
)
return request_outputs