Spaces:
Sleeping
Sleeping
CI: deploy Docker/PDM Space
Browse files
Dockerfile
CHANGED
|
@@ -28,14 +28,14 @@ ENV PIP_NO_CACHE_DIR=1 \
|
|
| 28 |
RUN mkdir -p /tmp/.streamlit /tmp/.cache /tmp/matplotlib /tmp/Ultralytics \
|
| 29 |
&& chmod -R 777 /tmp/.streamlit /tmp/.cache /tmp/matplotlib /tmp/Ultralytics
|
| 30 |
|
| 31 |
-
# Python deps (
|
| 32 |
RUN python -m pip install --upgrade pip setuptools wheel && \
|
| 33 |
pip install --no-cache-dir \
|
| 34 |
streamlit==1.49.1 \
|
| 35 |
moviepy==2.2.1 \
|
| 36 |
pillow>=10.0.0 \
|
| 37 |
ultralytics==8.0.196 \
|
| 38 |
-
torch==2.5.1 torchvision==0.20.1 --extra-index-url https://download.pytorch.org/whl/
|
| 39 |
|
| 40 |
|
| 41 |
# Copy entire repository and download script
|
|
|
|
| 28 |
RUN mkdir -p /tmp/.streamlit /tmp/.cache /tmp/matplotlib /tmp/Ultralytics \
|
| 29 |
&& chmod -R 777 /tmp/.streamlit /tmp/.cache /tmp/matplotlib /tmp/Ultralytics
|
| 30 |
|
| 31 |
+
# Python deps (CUDA-enabled PyTorch wheels)
|
| 32 |
RUN python -m pip install --upgrade pip setuptools wheel && \
|
| 33 |
pip install --no-cache-dir \
|
| 34 |
streamlit==1.49.1 \
|
| 35 |
moviepy==2.2.1 \
|
| 36 |
pillow>=10.0.0 \
|
| 37 |
ultralytics==8.0.196 \
|
| 38 |
+
torch==2.5.1 torchvision==0.20.1 --extra-index-url https://download.pytorch.org/whl/cu121
|
| 39 |
|
| 40 |
|
| 41 |
# Copy entire repository and download script
|
README.md
CHANGED
|
@@ -5,6 +5,7 @@ colorFrom: red
|
|
| 5 |
colorTo: red
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
# Introduction
|
|
@@ -33,7 +34,7 @@ Computer Vision object detection for National Search and Rescue (NATSAR)
|
|
| 33 |
5. Intstall packages and dependencies
|
| 34 |
|
| 35 |
hello
|
| 36 |
-
|
| 37 |
|
| 38 |
## Running the project locally
|
| 39 |
|
|
|
|
| 5 |
colorTo: red
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
+
hardware: gpu-t4-small
|
| 9 |
---
|
| 10 |
|
| 11 |
# Introduction
|
|
|
|
| 34 |
5. Intstall packages and dependencies
|
| 35 |
|
| 36 |
hello
|
| 37 |
+
`pdm install`
|
| 38 |
|
| 39 |
## Running the project locally
|
| 40 |
|
services/app_service/deim_model.py
CHANGED
|
@@ -64,7 +64,7 @@ class DeimHgnetV2MDrone(BaseModel):
|
|
| 64 |
+ (", ".join(sorted(set(available))) or "<none>")
|
| 65 |
)
|
| 66 |
|
| 67 |
-
self.device = device
|
| 68 |
cfg_path = weights_path.with_suffix(".json")
|
| 69 |
if not cfg_path.exists():
|
| 70 |
raise FileNotFoundError(
|
|
@@ -88,7 +88,7 @@ class DeimHgnetV2MDrone(BaseModel):
|
|
| 88 |
)
|
| 89 |
|
| 90 |
self.cfg = json.load(open(cfg_path, "r"))
|
| 91 |
-
self.model = torch.jit.load(weights_path, map_location=device).eval()
|
| 92 |
|
| 93 |
def _preprocess_image(self, image: Image):
|
| 94 |
transforms = T.Compose(
|
|
|
|
| 64 |
+ (", ".join(sorted(set(available))) or "<none>")
|
| 65 |
)
|
| 66 |
|
| 67 |
+
self.device = "cuda" if device == "gpu" and torch.cuda.is_available() else "cpu"
|
| 68 |
cfg_path = weights_path.with_suffix(".json")
|
| 69 |
if not cfg_path.exists():
|
| 70 |
raise FileNotFoundError(
|
|
|
|
| 88 |
)
|
| 89 |
|
| 90 |
self.cfg = json.load(open(cfg_path, "r"))
|
| 91 |
+
self.model = torch.jit.load(weights_path, map_location=self.device).eval()
|
| 92 |
|
| 93 |
def _preprocess_image(self, image: Image):
|
| 94 |
transforms = T.Compose(
|
services/app_service/pages/bushland_beacon.py
CHANGED
|
@@ -4,9 +4,8 @@ import time
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
import streamlit as st
|
| 7 |
-
from PIL import Image
|
| 8 |
-
|
| 9 |
from deim_model import DeimHgnetV2MDrone
|
|
|
|
| 10 |
|
| 11 |
# =============== Page setup ===============
|
| 12 |
st.set_page_config(
|
|
@@ -56,8 +55,9 @@ with st.sidebar:
|
|
| 56 |
st.markdown("<h4>Parameters</h4>", unsafe_allow_html=True)
|
| 57 |
conf_thr = st.slider("Minimum confidence threshold", 0.05, 0.95, 0.50, 0.01)
|
| 58 |
|
|
|
|
| 59 |
@st.cache_resource
|
| 60 |
-
def load_model(device: str = "
|
| 61 |
return DeimHgnetV2MDrone(device=device)
|
| 62 |
|
| 63 |
|
|
|
|
| 4 |
from pathlib import Path
|
| 5 |
|
| 6 |
import streamlit as st
|
|
|
|
|
|
|
| 7 |
from deim_model import DeimHgnetV2MDrone
|
| 8 |
+
from PIL import Image
|
| 9 |
|
| 10 |
# =============== Page setup ===============
|
| 11 |
st.set_page_config(
|
|
|
|
| 55 |
st.markdown("<h4>Parameters</h4>", unsafe_allow_html=True)
|
| 56 |
conf_thr = st.slider("Minimum confidence threshold", 0.05, 0.95, 0.50, 0.01)
|
| 57 |
|
| 58 |
+
|
| 59 |
@st.cache_resource
|
| 60 |
+
def load_model(device: str = "cuda"):
|
| 61 |
return DeimHgnetV2MDrone(device=device)
|
| 62 |
|
| 63 |
|
services/app_service/pages/lost_at_sea.py
CHANGED
|
@@ -59,7 +59,7 @@ with st.sidebar:
|
|
| 59 |
|
| 60 |
|
| 61 |
@st.cache_resource
|
| 62 |
-
def load_model(device: str = "
|
| 63 |
return DeimHgnetV2MDrone(device=device)
|
| 64 |
|
| 65 |
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
@st.cache_resource
|
| 62 |
+
def load_model(device: str = "cuda"):
|
| 63 |
return DeimHgnetV2MDrone(device=device)
|
| 64 |
|
| 65 |
|
services/app_service/pages/signal_watch.py
CHANGED
|
@@ -56,7 +56,7 @@ MODEL_ENTRIES = _discover_model_entries()
|
|
| 56 |
|
| 57 |
|
| 58 |
@st.cache_resource
|
| 59 |
-
def load_model(model_key: str, device: str = "
|
| 60 |
if model_key == "deim":
|
| 61 |
return DeimHgnetV2MDrone(device=device)
|
| 62 |
if not model_key.startswith("yolo:"):
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
@st.cache_resource
|
| 59 |
+
def load_model(model_key: str, device: str = "cuda"):
|
| 60 |
if model_key == "deim":
|
| 61 |
return DeimHgnetV2MDrone(device=device)
|
| 62 |
if not model_key.startswith("yolo:"):
|