| # The Space runs the firmware's own inference engine -- the same C code the | |
| # ESP32 compiles, built statically and shipped as a binary. A Python | |
| # re-implementation would be easier to write and would prove nothing: what | |
| # matters is how the C engine behaves after quantization, because that is what | |
| # runs on the board. | |
| # | |
| # The binary is here rather than the sources because this is a release | |
| # artefact, exactly like the .bin files in the firmware repository. | |
| FROM python:3.11-slim | |
| # Gradio wants a writable home; a Space container runs as a non-root user. | |
| RUN useradd -m -u 1000 app | |
| ENV HOME=/home/app PATH=/home/app/.local/bin:$PATH | |
| WORKDIR /app | |
| COPY --chown=app:app llmos-cli /usr/local/bin/llmos-cli | |
| RUN chmod +x /usr/local/bin/llmos-cli | |
| COPY --chown=app:app model/ model/ | |
| COPY --chown=app:app labels.json banner-en.png banner-fa.png ./ | |
| COPY --chown=app:app app.py requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| USER app | |
| ENV GRADIO_SERVER_NAME=0.0.0.0 GRADIO_SERVER_PORT=7860 LLMOS_CLI=llmos-cli | |
| EXPOSE 7860 | |
| CMD ["python", "app.py"] | |