flair icon indicating copy to clipboard operation
flair copied to clipboard

AWS python Docker file

Open faisalriazgoraya opened this issue 1 year ago • 4 comments

I'm currently attempting to upload an image using this Dockerfile, but I'm encountering an issue. Could someone please assist in resolving it or provide a Docker image? Docker file

# Use an official Python runtime as a parent image
FROM public.ecr.aws/lambda/python:3.9

# Set the working directory in the container
# WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

# Download Flair models
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('ner-ontonotes-large')"
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('pos-fast')"
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('upos-fast')"
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('chunk')"

# Copy your application files into the container
# COPY Flair ./Flair
# COPY Flair.py ./
# COPY main.py ./
COPY *.py ./

# Command to run the application
CMD ["main.lambda_handler"]

faisalriazgoraya avatar Feb 29 '24 18:02 faisalriazgoraya

Hi @faisalriazgoraya

When asking for help, it is always usefull to put in all the information required. Right now I can do nothing, but ask you "what is the issue you are encountering?".

Also, when you are sharing any kind of code, please put them into a code block, by adding ```` before and after the text. E.g.:

````
# this is a code block and will be formatted as such
same as this
````

vs

# this is a code block but will be displayed as a header 
while this will be a normal line

helpmefindaname avatar Mar 01 '24 09:03 helpmefindaname

# Use an official Python runtime as a parent image
FROM public.ecr.aws/lambda/python:3.9

# Set the working directory in the container
# WORKDIR /app

COPY requirements.txt .
RUN pip install -r requirements.txt

# Download Flair models
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('ner-ontonotes-large')"
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('pos-fast')"
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('upos-fast')"
RUN python -c "from flair.models import SequenceTagger; SequenceTagger.load('chunk')"

# Copy your application files into the container
# COPY Flair ./Flair
# COPY Flair.py ./
# COPY main.py ./
COPY *.py ./

# Command to run the application
CMD ["main.lambda_handler"]

this is my docker file code and trying to use it uploading my code to AWS lambda Function and facing error

faisalriazgoraya avatar Mar 01 '24 12:03 faisalriazgoraya

what error are you facing?

helpmefindaname avatar Mar 01 '24 16:03 helpmefindaname

Post a screenshot of the errors

cyberholics avatar Mar 28 '24 22:03 cyberholics