Worked on Docker Compose
This commit is contained in:
parent
7a1b4e992d
commit
e408ff47d5
|
@ -1,3 +1,4 @@
|
|||
# person.jpg
|
||||
# config.json
|
||||
config/
|
||||
.env
|
|
@ -0,0 +1,54 @@
|
|||
version: '2.4'
|
||||
networks:
|
||||
all:
|
||||
services:
|
||||
bridge:
|
||||
container_name: bridge-wyze
|
||||
restart: unless-stopped
|
||||
image: mrlt8/wyze-bridge:latest
|
||||
# ports:
|
||||
# - 1935:1935 # RTMP
|
||||
# - 8554:8554 # RTSP
|
||||
# - 8888:8888 # HLS
|
||||
# - 5000:5000 # WEB-UI
|
||||
environment:
|
||||
- WYZE_EMAIL=${WYZE_EMAIL} # Replace with wyze email
|
||||
- WYZE_PASSWORD=${WYZE_PASSWORD} # Replace with wyze password
|
||||
networks:
|
||||
all:
|
||||
aliases:
|
||||
- bridge
|
||||
ntfy:
|
||||
image: binwiederhier/ntfy
|
||||
container_name: ntfy-wyze
|
||||
command:
|
||||
- serve
|
||||
environment:
|
||||
- TZ=UTC # optional: set desired timezone
|
||||
# volumes:
|
||||
# - /var/cache/ntfy:/var/cache/ntfy
|
||||
# - /etc/ntfy:/etc/ntfy
|
||||
ports:
|
||||
- 9216:80
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
all:
|
||||
facial_recognition:
|
||||
container_name: face-recognition-wyze
|
||||
restart: unless-stopped
|
||||
image: ghcr.io/slashtechno/wyze_face_recognition:latest
|
||||
volumes:
|
||||
# ./config is mounted as /app/config
|
||||
- ./config:/app/config
|
||||
networks:
|
||||
all:
|
||||
environment:
|
||||
- RUN_BY_COMPOSE=true
|
||||
depends_on:
|
||||
- bridge
|
||||
# Use wait-for-it to wait for the bridge at port 8554 to be ready and then run /app/main.py
|
||||
command: /bin/sh -c "wait-for-it.sh bridge:8554 --timeout=0 --strict -- /app/main.py"
|
||||
|
||||
|
||||
# How can this be run and a .env file passed?
|
||||
# docker-compose up -d --env-file .env
|
6
main.py
6
main.py
|
@ -16,6 +16,7 @@ DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"
|
|||
# RUN_SCALE = 0.25
|
||||
# VIEW_SCALE = 0.75
|
||||
DISPLAY = False
|
||||
RUN_BY_COMPOSE = os.getenv("RUN_BY_COMPOSE")
|
||||
|
||||
|
||||
def find_face_from_name(name):
|
||||
|
@ -40,7 +41,8 @@ process_this_frame = True
|
|||
|
||||
# Load the config file, if it does not exist or is blank, create it
|
||||
config = {
|
||||
"URL": "rtsp://localhost:8554/example",
|
||||
# If RUN_BY_COMPOSE is true, set url to rtsp://wyze-bridge:8554/wyze_cam_name, otherwise set it to "rtsp://localhost:8554/wyze_cam_name"
|
||||
"URL": "rtsp://localhost:8554/wyze_cam_name" if not RUN_BY_COMPOSE else "rtsp://wyze-bridge:8554/wyze_cam_name",
|
||||
"run_scale": "0.25",
|
||||
"view_scale": "0.75",
|
||||
"faces": {
|
||||
|
@ -175,7 +177,7 @@ while True:
|
|||
)
|
||||
|
||||
# Display the resulting image if DISPLAY is set to true
|
||||
if DISPLAY:
|
||||
if config["display"]:
|
||||
cv2.imshow("Scaled View", view_frame)
|
||||
|
||||
# Hit 'q' on the keyboard to quit!
|
||||
|
|
Loading…
Reference in New Issue