Fix runtime error: move to Docker SDK with locked deps
The Space is in RUNTIME_ERROR:
from altair.vegalite.v4.api import Chart
ModuleNotFoundError: No module named 'altair.vegalite.v4'
The old Streamlit imports altair.vegalite.v4, which altair 5 removed. Pinning altair alone isn't enough: the streamlit SDK is no longer listed in the Spaces config reference, and the unpinned jax/flax/transformers would now resolve to versions without the Flax APIs this app uses (transformers v5 dropped Flax).
Changes
- Docker SDK:
README.mdโsdk: docker,app_port: 7860; newDockerfile(python 3.11, uid 1000, runs streamlit on 7860). - Locked deps:
requirements.txtis a fullpip freezeof a known-good env: jax/jaxlib 0.4.30, flax 0.8.5, transformers 4.46.3, nmslib 2.1.2, streamlit 1.40.2, numpy 1.26.4. The old jaxlib releases are no longer on PyPI, so 0.4.30 is the pin. app.py:@st.cache(allow_output_mutation=True)โ@st.cache_resource; dropped thehelp=kwarg fromst.write(it was always ignored and Streamlit now warns about it).
model/ and the nmslib index are unchanged.
Testing
Built the image for linux/amd64; rebuilding from the locked requirements gives an identical pip freeze. jaxlib needs AVX, which Apple Silicon's amd64 emulation lacks, so I ran the app from a native arm64 build with the same package versions (verified identical). Text search over the validation set returns sensible GIFs for the example queries. The upload/rank path (query_with_images: image + text forward pass, softmax) was run in the container on jpg and gif inputs.
๐ค Generated with Claude Code