changed docker to make it memory friendly
Browse files- S2FApp/Dockerfile +3 -5
- S2FApp/app.py +1 -1
S2FApp/Dockerfile
CHANGED
|
@@ -15,11 +15,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 15 |
# Copy requirements first for better caching
|
| 16 |
COPY requirements.txt .
|
| 17 |
|
| 18 |
-
# Install Python dependencies
|
| 19 |
-
RUN pip install --no-cache-dir \
|
| 20 |
-
|
| 21 |
-
numpy opencv-python streamlit matplotlib Pillow plotly \
|
| 22 |
-
huggingface_hub
|
| 23 |
|
| 24 |
# Copy app code (chown for HF Spaces permissions)
|
| 25 |
COPY --chown=user:user app.py predictor.py download_ckp.py ./
|
|
|
|
| 15 |
# Copy requirements first for better caching
|
| 16 |
COPY requirements.txt .
|
| 17 |
|
| 18 |
+
# Install Python dependencies - CPU-only PyTorch to fit Space memory limits (avoids OOM)
|
| 19 |
+
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu && \
|
| 20 |
+
pip install --no-cache-dir numpy opencv-python streamlit matplotlib Pillow plotly huggingface_hub
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Copy app code (chown for HF Spaces permissions)
|
| 23 |
COPY --chown=user:user app.py predictor.py download_ckp.py ./
|
S2FApp/app.py
CHANGED
|
@@ -18,7 +18,6 @@ S2F_ROOT = os.path.dirname(os.path.abspath(__file__))
|
|
| 18 |
if S2F_ROOT not in sys.path:
|
| 19 |
sys.path.insert(0, S2F_ROOT)
|
| 20 |
|
| 21 |
-
from predictor import S2FPredictor
|
| 22 |
from utils.substrate_settings import list_substrates
|
| 23 |
|
| 24 |
st.set_page_config(page_title="Shape2Force (S2F)", page_icon="🔬", layout="centered")
|
|
@@ -139,6 +138,7 @@ has_image = img is not None
|
|
| 139 |
if run and checkpoint and has_image:
|
| 140 |
with st.spinner("Loading model and predicting..."):
|
| 141 |
try:
|
|
|
|
| 142 |
predictor = S2FPredictor(
|
| 143 |
model_type=model_type,
|
| 144 |
checkpoint_path=checkpoint,
|
|
|
|
| 18 |
if S2F_ROOT not in sys.path:
|
| 19 |
sys.path.insert(0, S2F_ROOT)
|
| 20 |
|
|
|
|
| 21 |
from utils.substrate_settings import list_substrates
|
| 22 |
|
| 23 |
st.set_page_config(page_title="Shape2Force (S2F)", page_icon="🔬", layout="centered")
|
|
|
|
| 138 |
if run and checkpoint and has_image:
|
| 139 |
with st.spinner("Loading model and predicting..."):
|
| 140 |
try:
|
| 141 |
+
from predictor import S2FPredictor
|
| 142 |
predictor = S2FPredictor(
|
| 143 |
model_type=model_type,
|
| 144 |
checkpoint_path=checkpoint,
|