Skip to content
Snippets Groups Projects
Unverified Commit 48f8f5ac authored by Marcin Wątroba's avatar Marcin Wątroba
Browse files

Add Base service improvement

parent 9cda9759
Branches
1 merge request!10Feature/add auth asr service
...@@ -25,8 +25,11 @@ class AsrWebClient(AsrProcessor): ...@@ -25,8 +25,11 @@ class AsrWebClient(AsrProcessor):
def call_recognise(self, file_path: str) -> Dict[str, Any]: def call_recognise(self, file_path: str) -> Dict[str, Any]:
files = {"file": open(file_path, "rb")} files = {"file": open(file_path, "rb")}
headers = dict({'Authorization': f'Bearer {self._auth_token}'}) \ headers = (
if self._auth_token is not None else dict() 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) res = requests.post(self._url, files=files, headers=headers)
json_response = res.json() json_response = res.json()
print(json_response) print(json_response)
......
...@@ -49,7 +49,7 @@ class AsrProcessor(ABC): ...@@ -49,7 +49,7 @@ class AsrProcessor(ABC):
return None return None
def health_check(self) -> Response: def health_check(self) -> Response:
return jsonify({'status': 'running'}) return jsonify({"status": "running"})
def start_processor(self): def start_processor(self):
app = Flask(__name__) app = Flask(__name__)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment