Spaces:
Sleeping
Sleeping
abadesalex
commited on
Commit
•
2a00cb3
1
Parent(s):
8765030
change firectoty roog gensim
Browse files
Dockerfile
CHANGED
@@ -1,19 +1,19 @@
|
|
1 |
# Use Python 3.9 as base image
|
2 |
FROM python:3.9
|
3 |
|
4 |
-
# Set the
|
|
|
|
|
5 |
WORKDIR /code
|
6 |
|
7 |
# Copy the requirements.txt from the FastAPI folder into the working directory in the container
|
8 |
COPY ./FastAPI/requirements.txt /code/requirements.txt
|
9 |
|
10 |
-
# Install the Python packages specified in requirements.txt without cache and upgrading them
|
11 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
12 |
|
13 |
-
# Copy the FastAPI application directory into the working directory
|
14 |
COPY ./FastAPI/app /code/app
|
15 |
|
16 |
-
|
17 |
-
|
18 |
CMD ["uvicorn", "app.api:app", "--host", "0.0.0.0", "--port", "8000"]
|
19 |
-
|
|
|
1 |
# Use Python 3.9 as base image
|
2 |
FROM python:3.9
|
3 |
|
4 |
+
# Set the environment variable for Gensim data directory
|
5 |
+
ENV GENSIM_DATA_DIR=/app/gensim-data
|
6 |
+
|
7 |
WORKDIR /code
|
8 |
|
9 |
# Copy the requirements.txt from the FastAPI folder into the working directory in the container
|
10 |
COPY ./FastAPI/requirements.txt /code/requirements.txt
|
11 |
|
|
|
12 |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
13 |
|
|
|
14 |
COPY ./FastAPI/app /code/app
|
15 |
|
16 |
+
EXPOSE 8000
|
17 |
+
|
18 |
CMD ["uvicorn", "app.api:app", "--host", "0.0.0.0", "--port", "8000"]
|
19 |
+
|
FastAPI/app/utils/__pycache__/embedding.cpython-310.pyc
CHANGED
Binary files a/FastAPI/app/utils/__pycache__/embedding.cpython-310.pyc and b/FastAPI/app/utils/__pycache__/embedding.cpython-310.pyc differ
|
|
FastAPI/app/utils/embedding.py
CHANGED
@@ -1,6 +1,11 @@
|
|
1 |
-
import
|
|
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
4 |
|
5 |
|
6 |
def get_embedding(word):
|
|
|
1 |
+
import os
|
2 |
+
import gensim.downloader as api
|
3 |
|
4 |
+
# Ensure the environment variable is set correctly
|
5 |
+
gensim_data_dir = os.getenv('GENSIM_DATA_DIR', '/app/gensim-data')
|
6 |
+
|
7 |
+
# Load the GloVe model
|
8 |
+
model = api.load("glove-wiki-gigaword-50")
|
9 |
|
10 |
|
11 |
def get_embedding(word):
|