| FROM python:3.9-slim |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| build-essential \ |
| git \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| WORKDIR /code |
|
|
| |
| ENV PYTHONUNBUFFERED=1 \ |
| TRANSFORMERS_CACHE=/code/.cache \ |
| HF_HOME=/code/.cache |
|
|
| |
| RUN mkdir -p /code/.cache && chmod 777 /code/.cache |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| RUN useradd -m -u 1000 user \ |
| && chown -R user:user /code |
|
|
| |
| COPY . . |
| RUN chown -R user:user /code |
|
|
| |
| USER user |
|
|
| |
| RUN python -c "from transformers import AutoProcessor, AutoModelForVisualQuestionAnswering; \ |
| processor = AutoProcessor.from_pretrained('microsoft/OmniParser', trust_remote_code=True); \ |
| model = AutoModelForVisualQuestionAnswering.from_pretrained('microsoft/OmniParser', trust_remote_code=True)" |
|
|
| |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "8000"] |