Yash Chauhan commited on
Commit
3af511d
·
1 Parent(s): 5f6fe2c

[Updated] docker image

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -1
  2. app.py +3 -0
Dockerfile CHANGED
@@ -9,6 +9,9 @@ RUN apt-get update && apt-get install -y \
9
  python3-pip \
10
  && rm -rf /var/lib/apt/lists/*
11
 
 
 
 
12
  # Copy the required files
13
  COPY requirements.txt requirements.txt
14
  COPY app.py app.py
@@ -20,4 +23,4 @@ RUN pip install --no-cache-dir -r requirements.txt
20
  EXPOSE 7860
21
 
22
  # Run the application
23
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"]
 
9
  python3-pip \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ ENV TRANSFORMERS_CACHE=/app/cache
13
+ RUN mkdir -p /app/cache && chmod -R 777 /app/cache
14
+
15
  # Copy the required files
16
  COPY requirements.txt requirements.txt
17
  COPY app.py app.py
 
23
  EXPOSE 7860
24
 
25
  # Run the application
26
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import tempfile
2
 
3
  import numpy as np
@@ -5,6 +6,8 @@ import torch
5
  from fastapi import FastAPI, File, UploadFile
6
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
7
 
 
 
8
  app = FastAPI()
9
 
10
  # Device configuration
 
1
+ import os
2
  import tempfile
3
 
4
  import numpy as np
 
6
  from fastapi import FastAPI, File, UploadFile
7
  from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
8
 
9
+ os.environ["TRANSFORMERS_CACHE"] = "/app/cache"
10
+
11
  app = FastAPI()
12
 
13
  # Device configuration