robinroy03 commited on
Commit
e5e8307
1 Parent(s): 7322b82

Extended to 5 gunicorn workers, fixed embedding endpoint

Browse files
Files changed (2) hide show
  1. Dockerfile +2 -41
  2. main.py +1 -1
Dockerfile CHANGED
@@ -1,43 +1,4 @@
1
- # FROM python
2
-
3
- # WORKDIR /code
4
-
5
- # COPY ./requirements.txt /code/requirements.txt
6
-
7
- # RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
8
-
9
- # COPY . .
10
-
11
- # CMD ["gunicorn", "-w", "1", "main:app"]
12
-
13
- # ==============================================================================
14
-
15
- # FROM python
16
-
17
- # WORKDIR /code
18
-
19
- # COPY ./requirements.txt /code/requirements.txt
20
-
21
- # RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
22
-
23
- # RUN useradd -m -u 1000 user
24
-
25
- # USER user
26
-
27
- # ENV HOME=/home/user \
28
- # PATH=/home/user/.local/bin:$PATH
29
-
30
- # WORKDIR $HOME/app
31
-
32
- # RUN mkdir $HOME/.cache
33
-
34
- # COPY --chown=user . $HOME/app
35
-
36
- # CMD ["gunicorn", "-w", "1", "main:app"]
37
-
38
- # ==============================================================================
39
-
40
- FROM python
41
 
42
  RUN useradd -m -u 1000 user
43
  USER user
@@ -52,4 +13,4 @@ RUN mkdir $HOME/.cache
52
 
53
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
54
 
55
- CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860","main:app"]
 
1
+ FROM python:3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
  RUN useradd -m -u 1000 user
4
  USER user
 
13
 
14
  RUN pip install --no-cache-dir --upgrade -r requirements.txt
15
 
16
+ CMD ["gunicorn", "-w", "5", "-b", "0.0.0.0:7860","main:app"]
main.py CHANGED
@@ -19,7 +19,7 @@ def embedding():
19
  message = request.get_json()
20
  message = model.encode(message)
21
 
22
- return model.encode(message['text'])
23
 
24
 
25
  # curl -v -X POST 'http://127.0.0.1:8000/completion' --header 'Content-Type: application/json' --data '{"text": "what is an apple?"}'
 
19
  message = request.get_json()
20
  message = model.encode(message)
21
 
22
+ return {"output":model.encode(message['text'].tolist())}
23
 
24
 
25
  # curl -v -X POST 'http://127.0.0.1:8000/completion' --header 'Content-Type: application/json' --data '{"text": "what is an apple?"}'