Sync from GitHub: fffd2d77fb5e6af20308373ea8815a5f0349874f
Browse files- .gitattributes +1 -0
- .gitignore +4 -0
- Dockerfile +58 -0
- README.md +2 -3
- app.py +1 -9
- ng_tract-0.1.0-cp312-abi3-manylinux_2_34_x86_64.whl +3 -0
- requirements.txt +2 -0
.gitattributes
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
ng_tract-0.1.0-cp312-abi3-manylinux_2_34_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
.gitignore
CHANGED
|
@@ -4,4 +4,8 @@ __pycache__/
|
|
| 4 |
*.pyo
|
| 5 |
*.so
|
| 6 |
*.whl
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
tests/
|
|
|
|
| 4 |
*.pyo
|
| 5 |
*.so
|
| 6 |
*.whl
|
| 7 |
+
# Vendored ng_tract wheel — must be committed so HF Space sync includes
|
| 8 |
+
# it. The runtime installer in app.py pip-installs it in-process after
|
| 9 |
+
# the repo is COPY --link'd into /app (see HF Space build pipeline).
|
| 10 |
+
!ng_tract-0.1.0-cp312-abi3-manylinux_2_34_x86_64.whl
|
| 11 |
tests/
|
Dockerfile
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# NuWave HuggingFace Space — Docker image.
|
| 2 |
+
#
|
| 3 |
+
# Why Docker instead of Gradio SDK: HF Spaces' Gradio SDK only mounts
|
| 4 |
+
# requirements.txt during pip install (the repo is COPY --link'd later),
|
| 5 |
+
# so vendored local wheels can't resolve. Runtime install workarounds
|
| 6 |
+
# are fragile and leave import-cache traps. Docker gives us full control
|
| 7 |
+
# of the build — the ng_tract wheel installs at image build time, the
|
| 8 |
+
# Python process starts with everything already importable.
|
| 9 |
+
#
|
| 10 |
+
# Wheel distribution path: committed to the source GitHub repo (which
|
| 11 |
+
# accepts binaries), synced to this HF Space repo via `hf upload` CLI
|
| 12 |
+
# (which auto-routes binaries through Xet, bypassing the git-protocol
|
| 13 |
+
# pre-receive hook that blocks binaries). See .github/workflows/sync_to_hf.yml.
|
| 14 |
+
|
| 15 |
+
FROM python:3.12-slim
|
| 16 |
+
|
| 17 |
+
# System dependencies. onnxruntime pulls libgomp at runtime; without it,
|
| 18 |
+
# ng_embed fails with an opaque "cannot open shared object file" error
|
| 19 |
+
# on first embed call.
|
| 20 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 21 |
+
libgomp1 \
|
| 22 |
+
git \
|
| 23 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 24 |
+
|
| 25 |
+
# HF Spaces convention: run as non-root user with UID 1000. The Space
|
| 26 |
+
# host maps persistent storage to /data owned by this UID, so running
|
| 27 |
+
# as a different user breaks the state path.
|
| 28 |
+
RUN useradd -m -u 1000 user
|
| 29 |
+
USER user
|
| 30 |
+
ENV HOME=/home/user \
|
| 31 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 32 |
+
PYTHONDONTWRITEBYTECODE=1 \
|
| 33 |
+
PYTHONUNBUFFERED=1
|
| 34 |
+
|
| 35 |
+
WORKDIR /app
|
| 36 |
+
|
| 37 |
+
# Install pure-Python dependencies first — separate layer for caching.
|
| 38 |
+
# Requirements.txt copy is its own layer so a code change doesn't bust
|
| 39 |
+
# the dep install layer.
|
| 40 |
+
COPY --chown=user:user requirements.txt /app/requirements.txt
|
| 41 |
+
RUN pip install --no-cache-dir --user -r /app/requirements.txt
|
| 42 |
+
|
| 43 |
+
# Copy the rest of the repo (wheel included).
|
| 44 |
+
COPY --chown=user:user . /app
|
| 45 |
+
|
| 46 |
+
# Install the vendored ng_tract Rust wheel. --no-deps because it has
|
| 47 |
+
# none and we don't want pip resolving; --force-reinstall to guarantee
|
| 48 |
+
# a fresh install even if a same-version wheel somehow cached.
|
| 49 |
+
RUN pip install --no-cache-dir --user --force-reinstall --no-deps \
|
| 50 |
+
/app/ng_tract-0.1.0-cp312-abi3-manylinux_2_34_x86_64.whl
|
| 51 |
+
|
| 52 |
+
# Gradio serves on 7860 by convention on HF Spaces. Setting the env
|
| 53 |
+
# vars lets app.py's demo.launch() pick them up without hardcoding.
|
| 54 |
+
ENV GRADIO_SERVER_NAME=0.0.0.0 \
|
| 55 |
+
GRADIO_SERVER_PORT=7860
|
| 56 |
+
EXPOSE 7860
|
| 57 |
+
|
| 58 |
+
CMD ["python", "app.py"]
|
README.md
CHANGED
|
@@ -3,9 +3,8 @@ title: NuWave
|
|
| 3 |
emoji: 🧠
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
-
sdk:
|
| 7 |
-
|
| 8 |
-
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: agpl-3.0
|
| 11 |
---
|
|
|
|
| 3 |
emoji: 🧠
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: purple
|
| 6 |
+
sdk: docker
|
| 7 |
+
app_port: 7860
|
|
|
|
| 8 |
pinned: false
|
| 9 |
license: agpl-3.0
|
| 10 |
---
|
app.py
CHANGED
|
@@ -12,15 +12,7 @@ Splat-Lenia + BitNet model. On CPU. Gets smarter over time.
|
|
| 12 |
# -------------------
|
| 13 |
"""
|
| 14 |
|
| 15 |
-
|
| 16 |
-
import subprocess, sys, os
|
| 17 |
-
_whl = os.path.join(os.path.dirname(__file__), "ng_tract-0.1.0-cp312-abi3-manylinux_2_34_x86_64.whl")
|
| 18 |
-
if os.path.exists(_whl):
|
| 19 |
-
try:
|
| 20 |
-
import ng_tract
|
| 21 |
-
except ImportError:
|
| 22 |
-
subprocess.check_call([sys.executable, "-m", "pip", "install", _whl, "--quiet"])
|
| 23 |
-
|
| 24 |
import gradio as gr
|
| 25 |
import json
|
| 26 |
import logging
|
|
|
|
| 12 |
# -------------------
|
| 13 |
"""
|
| 14 |
|
| 15 |
+
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
import gradio as gr
|
| 17 |
import json
|
| 18 |
import logging
|
ng_tract-0.1.0-cp312-abi3-manylinux_2_34_x86_64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e890be59c5bd6ad0ae477da215c94ab6304342ef96ba9e0e1bc1e24a61c55faa
|
| 3 |
+
size 411958
|
requirements.txt
CHANGED
|
@@ -4,3 +4,5 @@ accelerate>=0.27.0
|
|
| 4 |
onnxruntime>=1.16.0
|
| 5 |
tokenizers>=0.15.0
|
| 6 |
msgpack>=1.0.0
|
|
|
|
|
|
|
|
|
| 4 |
onnxruntime>=1.16.0
|
| 5 |
tokenizers>=0.15.0
|
| 6 |
msgpack>=1.0.0
|
| 7 |
+
gradio==5.29.0
|
| 8 |
+
huggingface_hub>=0.25.0
|