import argparse from modules.api import create_app def get_args(): parser = argparse.ArgumentParser( description=f'Script for business documentation app starting.') parser.add_argument('--app-host', type=str, default='0.0.0.0', help='Host for the app') parser.add_argument('--app-port', type=int, default=9000, help='Port for the app') args = parser.parse_args() return args if __name__ == '__main__': args = get_args() app_host = args.app_host app_port = args.app_port app = create_app() app.run(host=app_host, port=app_port)
"""Module with API starting""" import argparse from modules.api import create_app from modules.utils import get_model_config, get_api_host_port if __name__ == '__main__': parser = argparse.ArgumentParser(description='Executes model on give image') model_config_dict = get_model_config() host, port = get_api_host_port() app = create_app(model_config_dict=model_config_dict) app.run(host=host, port=port)
def startapi(): click.echo('Starting REST API') config = ApiConfig() app = create_app(config) app.run(host="0.0.0.0", port=config.port)