File size: 2,733 Bytes
e9c697f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# ── Dockerfile for Hugging Face Spaces ──────────────────────────────────────
# Stack: Python 3.11, TensorFlow 2.20, RDKit 2025, nfp 0.3.12, FastAPI/uvicorn
# HF Spaces requires the app to listen on port 7860.
# ----------------------------------------------------------------------------

FROM python:3.11-slim

WORKDIR /app

# ── System dependencies ──────────────────────────────────────────────────────
# libxrender1 + libxext6 are needed by RDKit's drawing code.
# git is needed if any pip package installs from a git URL.
RUN apt-get update && apt-get install -y --no-install-recommends \
        libxrender1 \
        libxext6 \
        libglib2.0-0 \
        git \
    && rm -rf /var/lib/apt/lists/*

# ── Python dependencies ──────────────────────────────────────────────────────
# We pin exact versions from your requirements.txt to guarantee reproducibility.
# Flask, ngrok, reportlab, scikit-learn, pillow are kept because your existing
# code may use them (e.g. mimis_drawing). Remove anything you know is unused.
RUN pip install --no-cache-dir \
    fastapi==0.128.0 \
    uvicorn==0.40.0 \
    starlette==0.50.0 \
    pydantic==2.12.5 \
    tensorflow==2.20.0 \
    keras==3.13.1 \
    rdkit==2025.9.3 \
    nfp==0.3.12 \
    numpy==2.4.1 \
    pandas==3.0.0rc2 \
    joblib==1.5.3 \
    networkx==3.6.1 \
    scipy==1.17.0 \
    scikit-learn==1.8.0 \
    pillow==12.1.0 \
    reportlab==4.4.9 \
    h5py==3.15.1 \
    requests==2.32.5 \
    tqdm==4.67.1 \
    python-dateutil==2.9.0.post0 \
    six==1.17.0

# ── Copy application code ────────────────────────────────────────────────────
# Copy everything in your local directory into /app inside the container.
# Make sure your model weights (.keras) and vocab (.json) files are in the
# same directory as this Dockerfile before you push to HF.
COPY . .

# ── HF Spaces port ───────────────────────────────────────────────────────────
EXPOSE 7860

# ── Launch ───────────────────────────────────────────────────────────────────
CMD ["uvicorn", "api:app", "--host", "0.0.0.0", "--port", "7860"]