rajeshradhakrishnan commited on
Commit
5a9a0ec
1 Parent(s): 8d63192

English-Malayalam Translate v12

Browse files
Files changed (2) hide show
  1. Dockerfile +10 -5
  2. main.py +1 -1
Dockerfile CHANGED
@@ -1,25 +1,30 @@
1
  # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
  # you will also find guides on how best to write your Dockerfile
3
 
 
4
  FROM python:3.9
5
 
 
6
  WORKDIR /code
7
 
 
8
  COPY ./requirements.txt /code/requirements.txt
9
 
 
10
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
11
 
12
- COPY . .
13
-
14
  RUN useradd -m -u 1000 user
15
-
16
  USER user
17
-
18
  ENV HOME=/home/user \
19
  PATH=/home/user/.local/bin:$PATH
20
 
 
21
  WORKDIR $HOME/app
22
 
 
23
  COPY --chown=user . $HOME/app
24
 
25
- CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
  # you will also find guides on how best to write your Dockerfile
3
 
4
+ # Use the official Python 3.9 image
5
  FROM python:3.9
6
 
7
+ # Set the working directory to /code
8
  WORKDIR /code
9
 
10
+ # Copy the current directory contents into the container at /code
11
  COPY ./requirements.txt /code/requirements.txt
12
 
13
+ # Install requirements.txt
14
  RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
15
 
16
+ # Set up a new user named "user" with user ID 1000
 
17
  RUN useradd -m -u 1000 user
18
+ # Switch to the "user" user
19
  USER user
20
+ # Set home to the user's home directory
21
  ENV HOME=/home/user \
22
  PATH=/home/user/.local/bin:$PATH
23
 
24
+ # Set the working directory to the user's home directory
25
  WORKDIR $HOME/app
26
 
27
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
28
  COPY --chown=user . $HOME/app
29
 
30
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py CHANGED
@@ -1,7 +1,7 @@
1
  import os
2
  from fastapi import FastAPI
3
  from fastapi.staticfiles import StaticFiles
4
- from fastapi.responses import FileResponse
5
  from fastapi.templating import Jinja2Templates
6
  from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
7
 
 
1
  import os
2
  from fastapi import FastAPI
3
  from fastapi.staticfiles import StaticFiles
4
+ #from fastapi.responses import FileResponse
5
  from fastapi.templating import Jinja2Templates
6
  from transformers import MBartForConditionalGeneration, MBart50TokenizerFast
7