#TEST
This is a simple app that continuously observe one or multiple directories and run some operations as soon as an image is added to the directory.
Currently, the app can only resize the image to a fixed size and save it to a different directory. Other actions will be added (e.g., upload to a cloud storage, include other image processing operations). If you want to configure a new operation, just create a new ordinary function (check the file resize_image.py for reference) and then add the corresponding method in the observer (check the file observers.py for reference).
A simple frontend built with Fast API is also provided to show the status of all the observers and the images that have been processed.
The app is dockerized and can be run in a small container in order to be constantly running.
-
Install locally for development purposes
Clone the repository and install the required packages
git clone https://github.com/franioli/image_watcher_app.git cd image_watcher_appCreate a virtual environment with venv or conda:
python -m venv venv source venv/bin/activateor
conda create -n image_watcher_app python=3.12 conda activate image_watcher_app
Install the required packages:
pip install -r requirements.txt
For using the app, set the configuration in the
config.yamlfile. Theconfig.yamlfile is already set with the default values, but you can change it as you want.Note: The
config.yamlfile must be in the root directory of the cloned repo.Note2: If you are running the app locally, set the path to the directories you want to observe as for your local machine.
Then, run the app with:
python app
The app will be available at
http://localhost:9500. -
Install with Docker
Set the configuration in the
config.yamlfile as you want.Note: the path must start with '/data/', as this is where the directories are mounted in the container.
Set the path to volume to be mounted as '/data/' in the container
docker-compose.ymlfile (this is the path with the directories to be observed).Run the following command to build the docker image with docker compose and start the app:
docker compose up
The app will be available at
http://localhost:9500(Port 9500 is used to avoid conflicts with other services, but you can change it in theconfig.yaml,Dockerfileanddocker-compose.ymlfile. Remember to change all the files!).