Guillaume Moutier Guillaume Moutier commited on
Commit
9cdf9cf
·
unverified ·
1 Parent(s): b11b602

Fix main when workers > 1 (#35)

Browse files

Always load the app by using an import string

Signed-off-by: Guillaume Moutier <[email protected]>
Co-authored-by: Guillaume Moutier <[email protected]>

Files changed (1) hide show
  1. docling_serve/__main__.py +2 -2
docling_serve/__main__.py CHANGED
@@ -1,6 +1,5 @@
1
  import os
2
 
3
- from docling_serve.app import app
4
  from docling_serve.helper_functions import _str_to_bool
5
 
6
  # Launch the FastAPI server
@@ -10,8 +9,9 @@ if __name__ == "__main__":
10
  port = int(os.getenv("PORT", "5001"))
11
  workers = int(os.getenv("UVICORN_WORKERS", "1"))
12
  reload = _str_to_bool(os.getenv("RELOAD", "False"))
 
13
  run(
14
- app,
15
  host="0.0.0.0",
16
  port=port,
17
  workers=workers,
 
1
  import os
2
 
 
3
  from docling_serve.helper_functions import _str_to_bool
4
 
5
  # Launch the FastAPI server
 
9
  port = int(os.getenv("PORT", "5001"))
10
  workers = int(os.getenv("UVICORN_WORKERS", "1"))
11
  reload = _str_to_bool(os.getenv("RELOAD", "False"))
12
+
13
  run(
14
+ "docling_serve.app:app",
15
  host="0.0.0.0",
16
  port=port,
17
  workers=workers,