Spaces:
Sleeping
Sleeping
Commit
·
78dcb5e
1
Parent(s):
ec483d6
Add docker
Browse files
README.md
CHANGED
|
@@ -105,6 +105,18 @@ streamlit run app.py
|
|
| 105 |
```
|
| 106 |
and then open the browser and go to the address `http://localhost:8501`.
|
| 107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
## How to Develop
|
| 109 |
Do the following only once after creating your project:
|
| 110 |
- Init the git repo with `git init`.
|
|
@@ -121,7 +133,31 @@ Then create a branch with `git checkout -b BRANCH_NAME` for further developments
|
|
| 121 |
- For applying changes use `pre-commit run --all-files`.
|
| 122 |
|
| 123 |
## Docker Container
|
| 124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 125 |
|
| 126 |
## License
|
| 127 |
This repo is licensed under the Attribution–NonCommercial 4.0 International License (CC BY-NC 4.0).
|
|
|
|
| 105 |
```
|
| 106 |
and then open the browser and go to the address `http://localhost:8501`.
|
| 107 |
|
| 108 |
+
## How to load Trained Model from Hugging Face
|
| 109 |
+
The trained model is also uploaded to [hugging face](https://huggingface.co/afshin-dini/Egg-Detection) from which one can use it as following:
|
| 110 |
+
```shell
|
| 111 |
+
from huggingface_hub import hf_hub_download
|
| 112 |
+
from ultralytics import YOLO
|
| 113 |
+
|
| 114 |
+
model_path = hf_hub_download(repo_id="afshin-dini/Egg-Detection", filename="model/egg_detector.pt")
|
| 115 |
+
model = YOLO(model_path)
|
| 116 |
+
result = model("path/to/image")
|
| 117 |
+
```
|
| 118 |
+
Then, the uploaded model can be used for different purposes.
|
| 119 |
+
|
| 120 |
## How to Develop
|
| 121 |
Do the following only once after creating your project:
|
| 122 |
- Init the git repo with `git init`.
|
|
|
|
| 133 |
- For applying changes use `pre-commit run --all-files`.
|
| 134 |
|
| 135 |
## Docker Container
|
| 136 |
+
To run the docker with ssh, do the following first and then based on your need select ,test, development, or production containers:
|
| 137 |
+
```shell
|
| 138 |
+
export DOCKER_BUILDKIT=1
|
| 139 |
+
export DOCKER_SSHAGENT="-v $SSH_AUTH_SOCK:$SSH_AUTH_SOCK -e SSH_AUTH_SOCK"
|
| 140 |
+
```
|
| 141 |
+
### Test Container
|
| 142 |
+
This container is used for testing purposes while it runs the test
|
| 143 |
+
```shell
|
| 144 |
+
docker build --progress plain --ssh default --target test -t package_detection_docker:test .
|
| 145 |
+
docker run -it --rm -v "$(pwd):/app" $(echo $DOCKER_SSHAGENT) package_detection_docker:test
|
| 146 |
+
```
|
| 147 |
+
|
| 148 |
+
### Development Container
|
| 149 |
+
This container can be used for development purposes:
|
| 150 |
+
```shell
|
| 151 |
+
docker build --progress plain --ssh default --target development -t package_detection_docker:development .
|
| 152 |
+
docker run -it --rm -v "$(pwd):/app" -v /tmp:/tmp $(echo $DOCKER_SSHAGENT) package_detection_docker:development
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
### Production Container
|
| 156 |
+
This container can be used for production purposes:
|
| 157 |
+
```shell
|
| 158 |
+
docker build --progress plain --ssh default --target production -t package_detection_docker:production .
|
| 159 |
+
docker run -it --rm -v "$(pwd):/app" -v /tmp:/tmp $(echo $DOCKER_SSHAGENT) package_detection_docker:production deep_package_detection -vv infer --model_path src/deep_package_detection/model/package_detection.pt --data_path ./tests/test_data --result_path ./results
|
| 160 |
+
```
|
| 161 |
|
| 162 |
## License
|
| 163 |
This repo is licensed under the Attribution–NonCommercial 4.0 International License (CC BY-NC 4.0).
|