Skip to content

Commit

Permalink
Fixing the model hash changing when restarting the docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
hadikoub committed Jul 28, 2020
1 parent ab19754 commit 6f2fecd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ To run the API go the to the API's directory and run the following:
#### Using Linux based docker:

```sh
sudo NV_GPU=0 nvidia-docker run -itv $(pwd)/models:/models -p <docker_host_port>:1234 yolov4_inference_api_gpu
sudo NV_GPU=0 nvidia-docker run -itv $(pwd)/models:/models $(pwd)/models_hash:/models_hash -p <docker_host_port>:1234 yolov4_inference_api_gpu
```
The <docker_host_port> can be any unique port of your choice.

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/main/deep_learning_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def __init__(self):
# dictionary to hold the model instances (model_name: string -> model_instance: AbstractInferenceEngine)
self.models_dict = {}
# read from json file and append to dict
file_name = 'model_hash.json'
file_name = '/models_hash/model_hash.json'
file_exists = os.path.exists(file_name)
if file_exists:
try:
Expand All @@ -26,7 +26,7 @@ def __init__(self):
except:
self.models_hash_dict = {}
else:
with open('model_hash.json', 'w'):
with open('/models_hash/model_hash.json', 'w'):
self.models_hash_dict = {}
self.labels_hash_dict = {}
self.base_models_dir = '/models'
Expand Down Expand Up @@ -62,7 +62,7 @@ def load_all_models(self):
if key not in models:
del self.models_hash_dict[key]
# append to json file
with open('model_hash.json', "w") as fp:
with open('/models_hash/model_hash.json', "w") as fp:
json.dump(self.models_hash_dict, fp)
return self.models_hash_dict

Expand Down
Binary file removed src/main/result.jpg
Binary file not shown.

0 comments on commit 6f2fecd

Please sign in to comment.