Skip to content

Commit

Permalink
feat(api): limit simultaneous image workers (fixes #15)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Jan 13, 2023
1 parent 2ebba8a commit e872eea
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/onnx_web/serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
output_path = environ.get('ONNX_WEB_OUTPUT_PATH', path.join('..', 'outputs'))
params_path = environ.get('ONNX_WEB_PARAMS_PATH', 'params.json')

# options
num_workers = int(environ.get('ONNX_WEB_NUM_WORKERS', 2))

# pipeline caching
available_models = []
Expand Down Expand Up @@ -317,7 +319,10 @@ def load_params():
check_paths()
load_models()
load_params()

app = Flask(__name__)
app.config['EXECUTOR_MAX_WORKERS'] = num_workers

executor = Executor(app)

# routes
Expand Down

0 comments on commit e872eea

Please sign in to comment.