Spaces:
Sleeping
Sleeping
andykr1k commited on
Commit ·
4f2aacf
1
Parent(s): 4155b63
trying new config
Browse files- Dockerfile +26 -3
- app.py +1 -3
Dockerfile
CHANGED
|
@@ -1,5 +1,28 @@
|
|
| 1 |
FROM python:3.10.9
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 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"]
|
app.py
CHANGED
|
@@ -40,9 +40,7 @@ user_interactions = defaultdict(set)
|
|
| 40 |
post_features = {}
|
| 41 |
post_metadata = {}
|
| 42 |
|
| 43 |
-
|
| 44 |
-
os.makedirs('/data/.cache')
|
| 45 |
-
sentence_model = SentenceTransformer('all-MiniLM-L6-v2', cache_folder='/data/.cache')
|
| 46 |
|
| 47 |
SUPABASE_URL = os.getenv('supabaseUrl')
|
| 48 |
SUPABASE_KEY = os.getenv('supabaseAnonKey')
|
|
|
|
| 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')
|