Skip to content

Commit

Permalink
Reference clean-up
Browse files Browse the repository at this point in the history
  • Loading branch information
heming-h committed Jun 18, 2024
1 parent 766400e commit 6d79828
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 27 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -138,5 +138,4 @@ dmypy.json
# Test files
*.pt
.DS_Store
Finish_line_config.jpg
*.mp4
Binary file added Finish_line_config.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ Usage: python3 vision-ai-service/app.py
### Prepare .env filer (dummy parameter values supplied)
LOGGING_LEVEL=INFO
PHOTOS_FILE_PATH=vision-ai-service/files
VIDEO_URL=https://harnaes.no/maalfoto/2023SkiMaal.mp4
GLOBAL_SETTINGS_FILE=vision-ai-service/config/global_settings.json
VIDEO_STATUS_FILE=vision-ai-service/config/video_status.json

### Run all sessions
```
Expand Down
16 changes: 0 additions & 16 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,3 @@ services:
environment:
- HOST_PORT=8080
- LOGGING_LEVEL=${LOGGING_LEVEL}
- GLOBAL_SETTINGS_FILE=vision-ai-service/config/global_settings.json
- VIDEO_STATUS_FILE=vision-ai-service/config/video_status.json
- PHOTOS_FILE_PATH=tests/files
volumes:
- type: bind
source: ${GLOBAL_SETTINGS_FILE}
target: /app/${GLOBAL_SETTINGS_FILE}
- type: bind
source: ${VIDEO_STATUS_FILE}
target: /app/${VIDEO_STATUS_FILE}
- type: bind
source: ${PHOTOS_FILE_PATH}
target: /app/${PHOTOS_FILE_PATH}
- type: bind
source: error.log
target: /app/error.log
File renamed without changes.
4 changes: 2 additions & 2 deletions vision-ai-service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
# get base settings
load_dotenv()
CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
photos_file_path = os.getenv("PHOTOS_FILE_PATH", ".")
video_stream_url = os.getenv("VIDEO_URL")
photos_file_path = "vision-ai-service/files"

# set up logging
LOGGING_LEVEL = os.getenv("LOGGING_LEVEL", "INFO")
Expand Down Expand Up @@ -64,6 +63,7 @@ def main() -> None:
click.echo("Vision AI video detection is started...")
EventsAdapter().add_video_service_message("Starter AI video detection.")
EventsAdapter().update_global_setting("VIDEO_ANALYTICS_START", "False")
video_stream_url = EventsAdapter().get_global_setting("VIDEO_URL")
result = VisionAIService2().detect_crossings_with_ultraltyics(
photos_file_path, video_stream_url
)
Expand Down
1 change: 1 addition & 0 deletions vision-ai-service/config/global_settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"VIDEO_ANALYTICS_STOP": "False",
"DRAW_TRIGGER_LINE": "False",
"SHOW_VIDEO": "True",
"VIDEO_URL": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"DETECTION_BOX_MINIMUM_SIZE": "0.08",
"DETECTION_BOX_MAXIMUM_SIZE": "0.9"
}
9 changes: 4 additions & 5 deletions vision-ai-service/events_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from datetime import datetime
import json
import logging
import os
from zoneinfo import ZoneInfo


Expand All @@ -12,7 +11,7 @@ class EventsAdapter:

def get_global_setting(self, param_name: str) -> str:
"""Get global settings from global_settings.json file."""
config_file = os.getenv("GLOBAL_SETTINGS_FILE")
config_file = "vision-ai-service/config/global_settings.json"
try:
with open(config_file, "r") as json_file:
settings = json.load(json_file)
Expand All @@ -36,7 +35,7 @@ def get_global_setting_bool(self, param_name: str) -> bool:
def get_video_service_status_messages(self) -> list:
"""Get video service status."""
video_status = []
config_file = os.getenv("VIDEO_STATUS_FILE")
config_file = "vision-ai-service/files/video_status.json"
try:
with open(config_file, "r") as json_file:
video_status = json.load(json_file)
Expand All @@ -53,7 +52,7 @@ def add_video_service_message(self, message: str) -> None:
current_time = datetime.now()
time_text = current_time.strftime("%H:%M:%S")
video_status = []
config_file = os.getenv("VIDEO_STATUS_FILE")
config_file = "vision-ai-service/files/video_status.json"
try:
with open(config_file, "r") as json_file:
old_status = json.load(json_file)
Expand All @@ -79,7 +78,7 @@ def add_video_service_message(self, message: str) -> None:

def update_global_setting(self, param_name: str, new_value: str) -> None:
"""Update global_settings file."""
config_file = os.getenv("GLOBAL_SETTINGS_FILE")
config_file = "vision-ai-service/config/global_settings.json"
try:
# Open the global settings file in read-only mode.
with open(config_file, "r") as json_file:
Expand Down

0 comments on commit 6d79828

Please sign in to comment.