Newer
Older
import requests
class AsrProcessor(ABC):
@abstractmethod
def call_recognise(self, file_path: str) -> Dict[str, Any]:
"""
Currently most important is field `transcript` with list of transcript
words.
"""
pass
class AsrWebClient(AsrProcessor):
_url: str
def __init__(self, url: str, auth_token: Optional[str]):
super(AsrWebClient, self).__init__()
self._url = url
def call_recognise(self, file_path: str) -> Dict[str, Any]:
headers = (
dict({"Authorization": f"Bearer {self._auth_token}"})
if self._auth_token is not None
else dict()
)
res = requests.post(self._url, files=files, headers=headers, timeout=600)
json_response = res.json()
print(json_response)
return json_response