manav0506 commited on
Commit
2b9f9cb
·
1 Parent(s): 136e069

Sync deps: Dockerfile system deps + ffmpeg, single pip flow

Browse files
Files changed (4) hide show
  1. .streamlit/config.toml +8 -0
  2. Dockerfile +5 -2
  3. README.md +2 -1
  4. entrypoint.sh +12 -0
.streamlit/config.toml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ # Headless/Docker: do not open a browser; start server immediately
2
+ [server]
3
+ headless = true
4
+ enableCORS = false
5
+ enableXsrfProtection = false
6
+
7
+ [browser]
8
+ gatherUsageStats = false
Dockerfile CHANGED
@@ -36,9 +36,12 @@ RUN git clone --depth 1 https://github.com/VAST-AI-Research/TripoSR.git TripoSR
36
  COPY app.py .
37
  COPY scripts/ ./scripts/
38
  COPY pages/ ./pages/
 
 
 
39
 
40
  # HF Spaces expose port 7860
41
  EXPOSE 7860
42
  HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || true
43
- # xvfb-run provides a virtual display so TripoSR texture baking (ModernGL/X11) works in headless Docker
44
- ENTRYPOINT ["xvfb-run", "-a", "streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]
 
36
  COPY app.py .
37
  COPY scripts/ ./scripts/
38
  COPY pages/ ./pages/
39
+ COPY .streamlit/ ./.streamlit/
40
+ COPY entrypoint.sh /app/entrypoint.sh
41
+ RUN chmod +x /app/entrypoint.sh
42
 
43
  # HF Spaces expose port 7860
44
  EXPOSE 7860
45
  HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || true
46
+ # Start Xvfb in background then Streamlit (avoids xvfb-run which can hang in HF Spaces)
47
+ ENTRYPOINT ["/app/entrypoint.sh"]
README.md CHANGED
@@ -47,7 +47,8 @@ After that, run Skybox or Mesh again; the model will download on first use.
47
  - **"TripoSR not found"** → Rebuild the Space (the Dockerfile clones TripoSR). If you forked the Space, ensure the Dockerfile and `scripts/` are present.
48
  - **Mesh generation times out** → Use **Mesh resolution 256** and disable **Bake texture atlas** for a faster run; GPU Spaces are much faster than CPU.
49
  - **Build fails on torchmcubes** → The Dockerfile installs **CPU-only PyTorch** first (`--index-url https://download.pytorch.org/whl/cpu`) so torchmcubes can build without CUDA (Docker build has no GPU). Do not change the order of `pip install` steps; do not remove the CPU-index torch install or the build will fail with "Your installed Caffe2 version uses CUDA but I cannot find CUDA".
50
- - **"XOpenDisplay: cannot open display" / TripoSR baking texture fails** → TripoSR’s texture baking uses ModernGL, which needs an X11 display. The Dockerfile installs **xvfb** and runs the app with **xvfb-run -a** so a virtual display is available. Do not remove `xvfb` or change the ENTRYPOINT or baking will fail in the Space.
 
51
 
52
  ---
53
 
 
47
  - **"TripoSR not found"** → Rebuild the Space (the Dockerfile clones TripoSR). If you forked the Space, ensure the Dockerfile and `scripts/` are present.
48
  - **Mesh generation times out** → Use **Mesh resolution 256** and disable **Bake texture atlas** for a faster run; GPU Spaces are much faster than CPU.
49
  - **Build fails on torchmcubes** → The Dockerfile installs **CPU-only PyTorch** first (`--index-url https://download.pytorch.org/whl/cpu`) so torchmcubes can build without CUDA (Docker build has no GPU). Do not change the order of `pip install` steps; do not remove the CPU-index torch install or the build will fail with "Your installed Caffe2 version uses CUDA but I cannot find CUDA".
50
+ - **"XOpenDisplay: cannot open display" / TripoSR baking texture fails** → TripoSR’s texture baking uses ModernGL, which needs an X11 display. The image uses **entrypoint.sh** to start **Xvfb** in the background and then Streamlit so a virtual display is available. Do not remove `xvfb` or change the ENTRYPOINT or baking will fail in the Space.
51
+ - **Launch timed out / workload not healthy** → The app uses **entrypoint.sh** (Xvfb + Streamlit) and **.streamlit/config.toml** (headless) so startup is reliable. If it still times out, check Space logs for OOM or errors; consider upgrading to a larger machine.
52
 
53
  ---
54
 
entrypoint.sh ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/sh
2
+ # Start virtual display for TripoSR texture baking (ModernGL), then run Streamlit.
3
+ # Avoids xvfb-run which can hang or require xauth in some environments.
4
+ set -e
5
+ export DISPLAY=:99
6
+ # Start Xvfb in background; use -screen 0 so we have a valid display
7
+ Xvfb :99 -screen 0 1024x768x24 -ac &
8
+ XVFB_PID=$!
9
+ # Give Xvfb a moment to start
10
+ sleep 2
11
+ # Run Streamlit (replaces this process)
12
+ exec streamlit run app.py --server.port=7860 --server.address=0.0.0.0