Skip to content

Commit 508bb6d

Browse files
authored
Merge pull request #72 from ks6088ts-labs/feature/issue-71_support-datasource
add camera datasource
2 parents 048e015 + 739a4c9 commit 508bb6d

File tree

8 files changed

+64
-33
lines changed

8 files changed

+64
-33
lines changed

.github/workflows/docker-release.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ on:
66
jobs:
77
release:
88
runs-on: "ubuntu-latest"
9-
timeout-minutes: 5
109
steps:
1110
- name: Check out the repo
1211
uses: actions/checkout@v4

.github/workflows/docker.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ on:
1212
jobs:
1313
docker:
1414
runs-on: "ubuntu-latest"
15-
timeout-minutes: 5
1615
steps:
1716
- uses: actions/checkout@v4
1817
with:

.github/workflows/ghcr.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ env:
88
jobs:
99
ghcr:
1010
runs-on: ubuntu-latest
11-
timeout-minutes: 5
1211
permissions:
1312
packages: write
1413
contents: read

.github/workflows/test.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ jobs:
2020
python-version:
2121
- "3.10"
2222
runs-on: ${{ matrix.platform }}
23-
timeout-minutes: 5
2423
steps:
2524
- uses: actions/checkout@v4
2625
- name: Set up Poetry

Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,16 @@ ARG GIT_TAG="x.x.x"
1515

1616
WORKDIR /app
1717

18-
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.txt
18+
COPY --from=requirements-stage /tmp/requirements.txt /app/requirements.gen.txt
1919
COPY . .
2020

21+
# Install packages: https://stackoverflow.com/a/68666500/4457856
22+
# hadolint ignore=DL3008
23+
RUN apt-get update \
24+
&& apt-get install -y --no-install-recommends ffmpeg libsm6 libxext6 \
25+
&& rm -rf /var/lib/apt/lists/*
26+
2127
# Install dependencies
22-
RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt
28+
RUN pip install --no-cache-dir --upgrade -r /app/requirements.gen.txt
2329

2430
CMD ["python", "-m", "streamlit", "run", "apps/99_streamlit_examples/main.py"]

apps/99_streamlit_examples/pages/10_Object_detection.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,35 @@
1818
key="model_name",
1919
index=0,
2020
)
21+
data_source = st.selectbox(
22+
label="Select a data source",
23+
options=[
24+
"file",
25+
"camera",
26+
],
27+
key="data_source",
28+
index=0,
29+
)
2130

2231

2332
st.title("Object detection")
2433

25-
st.info("Upload an image and AI will detect objects in the image.")
26-
27-
uploaded_file = st.file_uploader(
28-
"Upload an image",
29-
type=(
30-
"jpg",
31-
"jpeg",
32-
"png",
33-
"gif",
34-
"bmp",
35-
"tiff",
36-
),
37-
)
34+
if data_source == "camera":
35+
st.info("AI will detect objects in the camera image.")
36+
uploaded_file = st.camera_input("Take a picture")
37+
if data_source == "file":
38+
st.info("Upload an image and AI will detect objects in the image.")
39+
uploaded_file = st.file_uploader(
40+
"Upload an image",
41+
type=(
42+
"jpg",
43+
"jpeg",
44+
"png",
45+
"gif",
46+
"bmp",
47+
"tiff",
48+
),
49+
)
3850
if uploaded_file is not None:
3951
button = st.button("Detect objects")
4052

apps/99_streamlit_examples/pages/11_Pose_estimation.py

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,36 @@
2828
index=1,
2929
key="model_complexity",
3030
)
31+
data_source = st.selectbox(
32+
label="Select a data source",
33+
options=[
34+
"file",
35+
"camera",
36+
],
37+
key="data_source",
38+
index=0,
39+
)
3140

3241

3342
st.title("Pose estimation")
3443

35-
st.info("Upload an image and AI will estimate the pose.")
44+
if data_source == "camera":
45+
st.info("AI will detect objects in the camera image.")
46+
uploaded_file = st.camera_input("Take a picture")
47+
if data_source == "file":
48+
st.info("Upload an image and AI will estimate the pose.")
49+
uploaded_file = st.file_uploader(
50+
"Upload an image",
51+
type=(
52+
"jpg",
53+
"jpeg",
54+
"png",
55+
"gif",
56+
"bmp",
57+
"tiff",
58+
),
59+
)
3660

37-
uploaded_file = st.file_uploader(
38-
"Upload an image",
39-
type=(
40-
"jpg",
41-
"jpeg",
42-
"png",
43-
"gif",
44-
"bmp",
45-
"tiff",
46-
),
47-
)
4861
if uploaded_file is not None:
4962
button = st.button("Estimate pose")
5063

requirements.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ langchain-openai==0.1.20
99
langchain-community==0.2.11
1010
azure-search-documents==11.5.1
1111
azure-identity==1.17.1
12-
ultralytics==8.2.77
13-
mediapipe==0.10.14
12+
13+
# To run 99_streamlit_examples/pages/10_Object_Detection.py
14+
# ultralytics==8.2.77
15+
16+
# To run 99_streamlit_examples/pages/11_Pose_Estimation.py
17+
# mediapipe==0.10.14

0 commit comments

Comments
 (0)