# ── 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"]