andykr1k commited on
Commit
0c98575
·
1 Parent(s): 4f2aacf

trying new config

Browse files
Files changed (2) hide show
  1. Dockerfile +3 -26
  2. app.py +3 -1
Dockerfile CHANGED
@@ -1,28 +1,5 @@
1
  FROM python:3.10.9
2
-
3
- # Install git-lfs for downloading large files from Hugging Face
4
- RUN apt-get update && apt-get install -y git-lfs
5
-
6
- # Create a directory for your model inside the container's /app directory
7
- # This directory is typically writable during the build process
8
- RUN mkdir -p /app/models/sentence-transformers_all-MiniLM-L6-v2
9
-
10
- # Clone the specific SentenceTransformer model into the created directory
11
- # This downloads the model files as part of the image build
12
- RUN git clone https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2 /app/models/sentence-transformers_all-MiniLM-L6-v2
13
-
14
- # Set the SENTENCE_TRANSFORMERS_HOME environment variable
15
- # This tells the SentenceTransformer library where to look for pre-downloaded models
16
- ENV SENTENCE_TRANSFORMERS_HOME=/app/models
17
-
18
- # Copy your application code into the /app directory in the container
19
- COPY . /app
20
-
21
- # Set the working directory to /app
22
- WORKDIR /app
23
-
24
- # Install your Python dependencies
25
- RUN pip install --no-cache-dir --upgrade -r requirements.txt
26
-
27
- # Command to run your FastAPI application
28
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10.9
2
+ COPY . .
3
+ WORKDIR /
4
+ RUN pip install --no-cache-dir --upgrade -r /requirements.txt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py CHANGED
@@ -40,7 +40,9 @@ user_interactions = defaultdict(set)
40
  post_features = {}
41
  post_metadata = {}
42
 
43
- sentence_model = SentenceTransformer('all-MiniLM-L6-v2')
 
 
44
 
45
  SUPABASE_URL = os.getenv('supabaseUrl')
46
  SUPABASE_KEY = os.getenv('supabaseAnonKey')
 
40
  post_features = {}
41
  post_metadata = {}
42
 
43
+ if not os.path.exists('/tmp/cache'):
44
+ os.makedirs('/tmp/cache')
45
+ sentence_model = SentenceTransformer('all-MiniLM-L6-v2', cache_folder='/tmp/cache')
46
 
47
  SUPABASE_URL = os.getenv('supabaseUrl')
48
  SUPABASE_KEY = os.getenv('supabaseAnonKey')