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

Add port to base service

parent 817fcd7a
Branches
1 merge request!10Feature/add auth asr service
......@@ -11,13 +11,15 @@ from flask_httpauth import HTTPTokenAuth
from sziszapangma.integration.base_asr_service.asr_result import AsrResult
_TEMP_DIRECTORY = "asr_processing"
_AUTH_TOKEN = 'AUTH_TOKEN'
_SERVICE_PORT = 'SERVICE_PORT'
class AsrProcessor(ABC):
user_token: str
def __init__(self):
self.user_token = os.environ["AUTH_TOKEN"]
self.user_token = os.environ[_AUTH_TOKEN]
@abstractmethod
def process_asr(self, audio_file_path: str) -> AsrResult:
......@@ -61,4 +63,5 @@ class AsrProcessor(ABC):
Path(_TEMP_DIRECTORY).mkdir(parents=True, exist_ok=True)
app.route("/process_asr", methods=["POST"])(auth.login_required(self.process_request))
app.route("/health_check", methods=["GET"])(self.health_check)
app.run(debug=True, host="0.0.0.0")
port = int(os.environ[_SERVICE_PORT]) if _SERVICE_PORT in os.environ else 5000
app.run(debug=True, host="0.0.0.0", port=port)
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