Removed / endpoint
Browse files- Dockerfile +6 -0
- app/main.py +1 -1
- requirements.txt +2 -1
Dockerfile
CHANGED
|
@@ -2,19 +2,25 @@ FROM python:3.11-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
|
|
|
| 5 |
RUN apt-get update && apt-get install -y \
|
| 6 |
tesseract-ocr \
|
| 7 |
libgl1 \
|
| 8 |
libglib2.0-0 \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
|
|
|
| 11 |
COPY requirements.txt .
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
|
|
|
| 14 |
RUN python -c "import torchvision.models as models; models.resnet50(weights = models.ResNet50_Weights.DEFAULT)"
|
| 15 |
|
|
|
|
| 16 |
COPY app ./app
|
| 17 |
|
|
|
|
| 18 |
EXPOSE 7860
|
| 19 |
|
|
|
|
| 20 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# Install system dependencies
|
| 6 |
RUN apt-get update && apt-get install -y \
|
| 7 |
tesseract-ocr \
|
| 8 |
libgl1 \
|
| 9 |
libglib2.0-0 \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Install Python dependencies
|
| 13 |
COPY requirements.txt .
|
| 14 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 15 |
|
| 16 |
+
# Preload embedding model to avoid first request delay
|
| 17 |
RUN python -c "import torchvision.models as models; models.resnet50(weights = models.ResNet50_Weights.DEFAULT)"
|
| 18 |
|
| 19 |
+
# Copy backend code
|
| 20 |
COPY app ./app
|
| 21 |
|
| 22 |
+
# Expose the port your FastAPI app uses
|
| 23 |
EXPOSE 7860
|
| 24 |
|
| 25 |
+
# Run the FastAPI app
|
| 26 |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
app/main.py
CHANGED
|
@@ -78,4 +78,4 @@ async def predict(file: UploadFile = File(...)):
|
|
| 78 |
import uvicorn
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
| 81 |
-
uvicorn.run("app.main:app", host="0.0.0.0", port=7860
|
|
|
|
| 78 |
import uvicorn
|
| 79 |
|
| 80 |
if __name__ == "__main__":
|
| 81 |
+
uvicorn.run("app.main:app", host="0.0.0.0", port=7860)
|
requirements.txt
CHANGED
|
@@ -10,4 +10,5 @@ opencv-python
|
|
| 10 |
pydantic
|
| 11 |
pydantic-settings
|
| 12 |
python-multipart
|
| 13 |
-
requests
|
|
|
|
|
|
| 10 |
pydantic
|
| 11 |
pydantic-settings
|
| 12 |
python-multipart
|
| 13 |
+
requests
|
| 14 |
+
uvicorn
|