Spaces:
Sleeping
Sleeping
pujan commited on
Commit ·
bb49f69
1
Parent(s): 3969b59
changes
Browse files- Dockerfile +8 -2
- app.py +3 -0
Dockerfile
CHANGED
|
@@ -2,10 +2,16 @@ FROM python:3.10
|
|
| 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 |
-
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /code
|
| 4 |
|
| 5 |
+
# Copy requirements and install dependencies
|
| 6 |
COPY ./requirements.txt /code/requirements.txt
|
|
|
|
| 7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 8 |
|
| 9 |
+
# Set up the cache directory for Hugging Face models
|
| 10 |
+
ENV TRANSFORMERS_CACHE=/code/.cache
|
| 11 |
+
RUN mkdir -p /code/.cache && chmod -R 777 /code/.cache
|
| 12 |
+
|
| 13 |
+
# Copy the application files
|
| 14 |
COPY . .
|
| 15 |
|
| 16 |
+
# Start the Flask app with Gunicorn
|
| 17 |
+
CMD ["gunicorn", "-b", "0.0.0.0:7860", "app"]
|
app.py
CHANGED
|
@@ -9,6 +9,9 @@ from history import load_dataset, get_unique_next_words_from_dataset
|
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
import os
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
from typing import List, Dict, Optional, Union
|
| 13 |
import logging
|
| 14 |
from most_repeted_sentences import sentences_name, get_most_repeated_sentences, save_most_repeated_sentences
|
|
|
|
| 9 |
from dotenv import load_dotenv
|
| 10 |
import os
|
| 11 |
|
| 12 |
+
os.environ["TRANSFORMERS_CACHE"] = "/code/.cache"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
from typing import List, Dict, Optional, Union
|
| 16 |
import logging
|
| 17 |
from most_repeted_sentences import sentences_name, get_most_repeated_sentences, save_most_repeated_sentences
|