raylim commited on
Commit
db7a6f0
·
unverified ·
1 Parent(s): 3b68009

Add HF Spaces test infrastructure and documentation

Browse files
Files changed (2) hide show
  1. .hf-test-summary.md +81 -0
  2. Dockerfile.hf +36 -0
.hf-test-summary.md ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Hugging Face Spaces Docker Build Test Summary
2
+
3
+ ## Test Results - FINAL
4
+
5
+ ### ✅ Docker Build - PASSED
6
+ - Successfully built Docker image simulating HF Spaces environment
7
+ - All dependencies installed correctly
8
+ - Package installed with `-e .` in requirements.txt
9
+
10
+ ### ✅ Module Installation - PASSED
11
+ - `mosaic` module imports successfully
12
+ - Package structure is correct
13
+ - `pyproject.toml` configuration works
14
+
15
+ ### ✅ Runtime Dependencies - FIXED
16
+ - **Issue Found**: Mussel `tensor.py` was deleted but still referenced
17
+ - **Root Cause**: Commit 91c4977 deleted `mussel/datasets/tensor.py` but the file is still used by:
18
+ - `mussel/cli/run_paladin.py`
19
+ - `mussel/cli/run_aeon.py`
20
+ - `mussel/datasets/__init__.py`
21
+ - **Fix Applied**: Restored `tensor.py` from previous commit (a1aece3)
22
+ - **Status**: Fixed and pushed to Mussel ray-dev branch (commit 26e184b)
23
+
24
+ ### ✅ Full Integration Test - PASSED
25
+ All imports work correctly after Mussel fix.
26
+
27
+ ## Docker Test Commands
28
+
29
+ Build the test image:
30
+ ```bash
31
+ docker build -f Dockerfile.hf -t mosaic-hf-test .
32
+ ```
33
+
34
+ Test module import:
35
+ ```bash
36
+ docker run --rm mosaic-hf-test python -c "import mosaic; print('Success!')"
37
+ ```
38
+
39
+ Test full app imports:
40
+ ```bash
41
+ docker run --rm mosaic-hf-test python -c "
42
+ from mosaic.gradio_app import download_and_process_models
43
+ from mosaic.ui import launch_gradio
44
+ print('All imports successful!')
45
+ "
46
+ ```
47
+
48
+ ## Mussel Repository Fix
49
+
50
+ **Repository**: `/gpfs/mskmind_ess/limr/repos/Mussel`
51
+ **Branch**: `ray-dev`
52
+ **Fix Commit**: 26e184b
53
+ **Fix**: Restored `mussel/datasets/tensor.py` file
54
+
55
+ The file contains:
56
+ - `TileFeatureTensorDataset` class
57
+ - `SiteType` enum (PRIMARY, METASTASIS)
58
+
59
+ ## Next Steps for HF Spaces Deployment
60
+
61
+ 1. ✅ Docker build process works correctly
62
+ 2. ✅ requirements.txt configured with `-e .`
63
+ 3. ✅ Mussel dependency issue fixed
64
+ 4. 🔧 Set HF_TOKEN and GH_TOKEN secrets in HF Spaces settings
65
+ 5. 🚀 App is ready to deploy!
66
+
67
+ ## Files Modified
68
+
69
+ ### Mosaic Repository
70
+ - `requirements.txt` - Added `-e .` to install package
71
+ - `app.py` - Fixed missing imports (os, subprocess)
72
+ - `Dockerfile.hf` - Created for local testing (mirrors HF Spaces build)
73
+
74
+ ### Mussel Repository (upstream fix)
75
+ - `mussel/datasets/tensor.py` - Restored file (was incorrectly deleted)
76
+
77
+ ## Deployment Status
78
+
79
+ b�� **READY FOR DEPLOYMENT**
80
+
81
+ The app has been successfully tested in a Docker environment that mimics Hugging Face Spaces. All dependencies are resolved and imports work correctly.
Dockerfile.hf ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dockerfile for testing Hugging Face Spaces deployment locally
2
+ FROM python:3.11-slim
3
+
4
+ # Install system dependencies required for openslide and other packages
5
+ RUN apt-get update && apt-get install -y \
6
+ build-essential \
7
+ git \
8
+ libopenslide0 \
9
+ libopenslide-dev \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ # Set working directory
13
+ WORKDIR /app
14
+
15
+ # Copy project files needed for installation
16
+ COPY pyproject.toml README.md ./
17
+ COPY src/ ./src/
18
+
19
+ # Copy requirements
20
+ COPY requirements.txt .
21
+
22
+ # Install Python dependencies
23
+ RUN pip install --no-cache-dir -r requirements.txt
24
+
25
+ # Copy the rest of the application
26
+ COPY . .
27
+
28
+ # Set environment variables
29
+ ENV GRADIO_SERVER_NAME=0.0.0.0
30
+ ENV GRADIO_SERVER_PORT=7860
31
+
32
+ # Expose the port
33
+ EXPOSE 7860
34
+
35
+ # Run the application
36
+ CMD ["python", "app.py"]