Fix runtime error: move to Docker SDK with locked deps

#2
by ceyda - opened

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; new Dockerfile (python 3.11, uid 1000, runs streamlit on 7860).
  • Locked deps: requirements.txt is a full pip freeze of 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 the help= kwarg from st.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

ceyda changed pull request status to open
ceyda changed pull request status to merged

Sign up or log in to comment