rename app and bump dependencies
parent
01d5cf04a3
commit
8dbba6d7ab
|
@ -12,4 +12,4 @@ COPY app /app
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENTRYPOINT [ "streamlit", "run"]
|
ENTRYPOINT [ "streamlit", "run"]
|
||||||
CMD ["streamlit-ui.py"]
|
CMD ["deepstack-ui.py"]
|
56
README.md
56
README.md
|
@ -9,24 +9,28 @@ UI for working with [Deepstack](https://python.deepstack.cc/). Allows uploading
|
||||||
Run deepstack object detection:
|
Run deepstack object detection:
|
||||||
|
|
||||||
```
|
```
|
||||||
docker run -e VISION-DETECTION=True -p 5000:5000 -e API-KEY="" -e MODE=High deepquestai/deepstack:cpu-x6-beta
|
docker run -e VISION-DETECTION=True -p 5000:5000 -e API-KEY="" -e MODE=High deepquestai/deepstack:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
You will need the ip address of the machine running deepstack, which is passed to the Streamlit app.
|
You will need the ip address of the machine running deepstack, which is passed to the Streamlit app using an environment variable.
|
||||||
|
|
||||||
## Run with Docker
|
## Run deepstack-ui with Docker
|
||||||
From the root dir, build from source then run the UI:
|
The `deepstack-ui` is designed to be run in a docker container. The UI picks up the information about your deepstack instance from environment variables which are passed into the container using the `-e VARIABLE=value` approach. All environment variables that can be passed are listed below:
|
||||||
|
```
|
||||||
|
- DEEPSTACK_IP : the IP address of your deepstack instance, default "localhost"
|
||||||
|
- DEEPSTACK_PORT : the PORT of your deepstack instance, default 80
|
||||||
|
- DEEPSTACK_API_KEY : the API key of your deepstack instance, if you have set one
|
||||||
|
- DEEPSTACK_TIMEOUT : the timeout to wait for deepstack, default 10 seconds
|
||||||
|
```
|
||||||
|
|
||||||
|
From the root dir, build the deepstack-ui container from source and then run the UI, passing the `DEEPSTACK_IP` environment variable:
|
||||||
```
|
```
|
||||||
docker build -t deepstack-ui .
|
docker build -t deepstack-ui .
|
||||||
docker run -p 8501:8501 -e DEEPSTACK_IP='192.168.1.133' deepstack-ui:latest
|
docker run -p 8501:8501 -e DEEPSTACK_IP='192.168.1.133' deepstack-ui:latest
|
||||||
```
|
```
|
||||||
The UI is now viewable at [http://localhost:8501](http://localhost:8501)
|
The UI is now viewable at [http://localhost:8501](http://localhost:8501) (not whatever ip address is shown in the logs, this is the internal docker ip)
|
||||||
|
|
||||||
Alternatively run the [pre-built](https://hub.docker.com/repository/docker/robmarkcole/deepstack-ui) image in daemon mode:
|
Alternatively if you are running deepstack with non default parameters, an example would be:
|
||||||
```
|
|
||||||
docker run -p 8501:8501 -e DEEPSTACK_IP='192.168.1.133' -d --name deepstack_ui robmarkcole/deepstack-ui:latest
|
|
||||||
```
|
|
||||||
Or if you are running deepstack with non default parameters, an example would be:
|
|
||||||
```
|
```
|
||||||
docker run -p 8501:8501 \
|
docker run -p 8501:8501 \
|
||||||
-e DEEPSTACK_IP='192.168.1.133' \
|
-e DEEPSTACK_IP='192.168.1.133' \
|
||||||
|
@ -36,34 +40,6 @@ docker run -p 8501:8501 \
|
||||||
robmarkcole/deepstack-ui:latest`
|
robmarkcole/deepstack-ui:latest`
|
||||||
```
|
```
|
||||||
|
|
||||||
Then visit [localhost:8501](http://localhost:8501/) (not whatever ip address is shown in the logs, this is the internal docker ip)
|
|
||||||
|
|
||||||
Above examples for using with docker-compose:
|
|
||||||
```
|
|
||||||
deepstack:
|
|
||||||
container_name: deepstack
|
|
||||||
restart: unless-stopped
|
|
||||||
image: deepquestai/deepstack:cpu-x3-beta
|
|
||||||
ports:
|
|
||||||
- '5000:5000'
|
|
||||||
environment:
|
|
||||||
- VISION-DETECTION=True
|
|
||||||
- API-KEY=""
|
|
||||||
volumes:
|
|
||||||
- /srv/docker/deepstack:/datastore
|
|
||||||
deepstack_ui:
|
|
||||||
container_name: deepstack_ui
|
|
||||||
restart: unless-stopped
|
|
||||||
image: robmarkcole/deepstack-ui:latest
|
|
||||||
environment:
|
|
||||||
- DEEPSTACK_IP=deepstack
|
|
||||||
- DEEPSTACK_PORT=5000
|
|
||||||
- DEEPSTACK_API_KEY=""
|
|
||||||
- DEEPSTACK_TIMEOUT=20
|
|
||||||
ports:
|
|
||||||
- '8501:8501'
|
|
||||||
```
|
|
||||||
|
|
||||||
### FAQ
|
### FAQ
|
||||||
Q1: I get the error: `TypeError: cannot unpack non-iterable DeepstackException object`
|
Q1: I get the error: `TypeError: cannot unpack non-iterable DeepstackException object`
|
||||||
|
|
||||||
|
@ -74,5 +50,5 @@ A1: You probably didn't pass the required environment variables (`DEEPSTACK_IP`
|
||||||
## Development
|
## Development
|
||||||
* Create and activate a venv: `python3 -m venv venv` and `source venv/bin/activate`
|
* Create and activate a venv: `python3 -m venv venv` and `source venv/bin/activate`
|
||||||
* Install requirements: `pip3 install -r requirements.txt`
|
* Install requirements: `pip3 install -r requirements.txt`
|
||||||
* Export required environment variable: `export DEEPSTACK_IP='192.168.1.133'`
|
* Export required environment variables: `export DEEPSTACK_IP='192.168.1.133'`
|
||||||
* Run streamlit from `app` folder: `streamlit run streamlit-ui.py`
|
* Run streamlit from `app` folder: `streamlit run deepstack-ui.py`
|
|
@ -11,11 +11,11 @@ import const
|
||||||
|
|
||||||
## Depstack setup
|
## Depstack setup
|
||||||
DEEPSTACK_IP = os.getenv("DEEPSTACK_IP", "localhost")
|
DEEPSTACK_IP = os.getenv("DEEPSTACK_IP", "localhost")
|
||||||
DEEPSTACK_PORT = os.getenv("DEEPSTACK_PORT", 5000)
|
DEEPSTACK_PORT = os.getenv("DEEPSTACK_PORT", 80)
|
||||||
DEEPSTACK_API_KEY = os.getenv("DEEPSTACK_API_KEY", "")
|
DEEPSTACK_API_KEY = os.getenv("DEEPSTACK_API_KEY", "")
|
||||||
DEEPSTACK_TIMEOUT = int(os.getenv("DEEPSTACK_TIMEOUT", 10))
|
DEEPSTACK_TIMEOUT = int(os.getenv("DEEPSTACK_TIMEOUT", 20))
|
||||||
|
|
||||||
DEFAULT_CONFIDENCE_THRESHOLD = 0
|
DEFAULT_CONFIDENCE_THRESHOLD = 45 # percent
|
||||||
TEST_IMAGE = "street.jpg"
|
TEST_IMAGE = "street.jpg"
|
||||||
|
|
||||||
DEFAULT_ROI_Y_MIN = 0.0
|
DEFAULT_ROI_Y_MIN = 0.0
|
||||||
|
@ -35,8 +35,7 @@ predictions = None
|
||||||
@st.cache
|
@st.cache
|
||||||
def process_image(pil_image, dsobject):
|
def process_image(pil_image, dsobject):
|
||||||
image_bytes = utils.pil_image_to_byte_array(pil_image)
|
image_bytes = utils.pil_image_to_byte_array(pil_image)
|
||||||
dsobject.detect(image_bytes)
|
predictions = dsobject.detect(image_bytes)
|
||||||
predictions = dsobject.predictions
|
|
||||||
return predictions
|
return predictions
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
deepstack:
|
||||||
|
container_name: deepstack
|
||||||
|
restart: unless-stopped
|
||||||
|
image: deepquestai/deepstack:latest
|
||||||
|
ports:
|
||||||
|
- '5000:5000'
|
||||||
|
environment:
|
||||||
|
- VISION-DETECTION=True
|
||||||
|
- API-KEY=""
|
||||||
|
volumes:
|
||||||
|
- /srv/docker/deepstack:/datastore
|
||||||
|
deepstack_ui:
|
||||||
|
container_name: deepstack_ui
|
||||||
|
restart: unless-stopped
|
||||||
|
image: robmarkcole/deepstack-ui:latest
|
||||||
|
environment:
|
||||||
|
- DEEPSTACK_IP=deepstack
|
||||||
|
- DEEPSTACK_PORT=5000
|
||||||
|
- DEEPSTACK_API_KEY=""
|
||||||
|
- DEEPSTACK_TIMEOUT=20
|
||||||
|
ports:
|
||||||
|
- '8501:8501'
|
|
@ -1,4 +1,4 @@
|
||||||
numpy>=1.18.5
|
numpy>=1.18.5
|
||||||
Pillow>=7.1.2
|
Pillow>=7.1.2
|
||||||
deepstack-python==0.6
|
deepstack-python==0.7
|
||||||
streamlit==0.70.0
|
streamlit==0.72.0
|
Loading…
Reference in New Issue