Spaces:
Sleeping
Sleeping
- Dockerfile +7 -0
- main.py +4 -1
Dockerfile
CHANGED
@@ -6,6 +6,13 @@ COPY ./requirements.txt /code/requirements.txt
|
|
6 |
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
COPY . .
|
10 |
|
11 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
6 |
|
7 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
8 |
|
9 |
+
# Set an environment variable for the NLTK data directory
|
10 |
+
ENV NLTK_DATA /code/nltk_data
|
11 |
+
|
12 |
+
# Create the directory for NLTK data and download the 'punkt' tokenizer models
|
13 |
+
RUN mkdir -p $NLTK_DATA && \
|
14 |
+
python -m nltk.downloader -d $NLTK_DATA punkt
|
15 |
+
|
16 |
COPY . .
|
17 |
|
18 |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
CHANGED
@@ -6,7 +6,10 @@ import uvicorn
|
|
6 |
from typing import Generator
|
7 |
import json # Asegúrate de que esta línea esté al principio del archivo
|
8 |
import nltk
|
9 |
-
|
|
|
|
|
|
|
10 |
|
11 |
app = FastAPI()
|
12 |
|
|
|
6 |
from typing import Generator
|
7 |
import json # Asegúrate de que esta línea esté al principio del archivo
|
8 |
import nltk
|
9 |
+
import os
|
10 |
+
|
11 |
+
|
12 |
+
nltk.data.path.append(os.getenv('NLTK_DATA'))
|
13 |
|
14 |
app = FastAPI()
|
15 |
|