csvaldellon commited on
Commit
fecebcb
·
1 Parent(s): 929d64b

test: use uvicorn for running app at end of build

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -1
  2. app/main.py +5 -5
Dockerfile CHANGED
@@ -16,4 +16,5 @@ RUN bash download_model.sh
16
  COPY app/ app/
17
 
18
  # runs our application at the start of the docker image
19
- CMD ["python", "app/main.py"]
 
 
16
  COPY app/ app/
17
 
18
  # runs our application at the start of the docker image
19
+ # CMD ["python", "app/main.py"]
20
+ CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
app/main.py CHANGED
@@ -3,7 +3,7 @@ from fastapi import FastAPI, Request
3
  from utils import QASearcher
4
 
5
  app = FastAPI()
6
-
7
 
8
  @app.post("/set_context")
9
  async def set_context(data: Request):
@@ -39,7 +39,7 @@ async def get_answer(data: Request):
39
  return response
40
 
41
 
42
- # initialises the QA model and starts the uvicorn app
43
- if __name__ == "__main__":
44
- qa_search = QASearcher()
45
- uvicorn.run(app, host="0.0.0.0", port=8000)
 
3
  from utils import QASearcher
4
 
5
  app = FastAPI()
6
+ qa_search = QASearcher()
7
 
8
  @app.post("/set_context")
9
  async def set_context(data: Request):
 
39
  return response
40
 
41
 
42
+ # # initialises the QA model and starts the uvicorn app
43
+ # if __name__ == "__main__":
44
+
45
+ # uvicorn.run(app, host="0.0.0.0", port=8000)