1
0
Fork 0

feat(api): switch API server to Waitress (#159)

This commit is contained in:
Sean Sube 2023-04-10 23:21:13 -05:00
parent e3540ac435
commit 76860f649a
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
6 changed files with 29 additions and 6 deletions

View File

@ -9,4 +9,10 @@ python -m onnx_web.convert ^
--token=%HF_TOKEN% %ONNX_WEB_EXTRA_ARGS%
echo "Launching API server..."
flask --app="onnx_web.main:run" run --host=0.0.0.0
waitress-serve ^
--host=0.0.0.0 ^
--port=5000 ^
--call ^
onnx_web.main:run
pause

View File

@ -26,4 +26,8 @@ python3 -m onnx_web.convert \
${ONNX_WEB_EXTRA_ARGS:-}
echo "Launching API server..."
flask --app='onnx_web.main:run' run --host=0.0.0.0
waitress-serve \
--host=0.0.0.0 \
--port=5000 \
--call \
onnx_web.main:run

View File

@ -7,4 +7,10 @@ python -m onnx_web.convert ^
--token=%HF_TOKEN% %ONNX_WEB_EXTRA_ARGS%
echo "Launching API server..."
flask --app="onnx_web.main:run" run --host=0.0.0.0
waitress-serve ^
--host=0.0.0.0 ^
--port=5000 ^
--call ^
onnx_web.main:run
pause

View File

@ -25,4 +25,8 @@ python3 -m onnx_web.convert \
${ONNX_WEB_EXTRA_ARGS:-}
echo "Launching API server..."
flask --app='onnx_web.main:run' run --host=0.0.0.0
waitress-serve \
--host=0.0.0.0 \
--port=5000 \
--call \
onnx_web.main:run

View File

@ -78,7 +78,9 @@ def run():
if __name__ == "__main__":
app, pool = main()
logger.info("starting image workers")
pool.start()
logger.info("starting API server")
app.run("0.0.0.0", 5000, debug=is_debug())
logger.info("shutting down app")
logger.info("shutting down workers")
pool.join()

View File

@ -25,4 +25,5 @@ flask
flask-cors
jsonschema
pyyaml
setproctitle
setproctitle
waitress