diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7df124a33b21e7d95af62d6dcc54c1109902c49a..9c9ad212278ffd4862a1ccb74699be127ab089fa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -70,7 +70,6 @@ install-npm-packages: lint-back: stage: test - allow_failure: true before_script: - python3 -m venv venv/ - source venv/bin/activate @@ -82,7 +81,6 @@ lint-back: lint-front: image: node:14.6.0 stage: test - allow_failure: true script: - cd frontend/ - npm run lint diff --git a/README.md b/README.md index 5a6add68b759839d8335b6938de512ab66b94a5b..b2cde2289aa296de7e294a0cade6783cfbf3e16a 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,56 @@ -**README** -========== -# Run the server-side FastAPI app -## In development mode -Using the template files, you first need to create backend/.env and backend/cameras.py. -You can start a virtual environment with the following instructions. - -```sh -$ cd backend -$ python3.9 -m venv env -$ source env/bin/activate -``` - -Then you need to install the dependencies by executing `pip install -r requirements.txt` -Comment the app service in the docker-compose.yml then build and run the file. -Start the development server running `python -m uvicorn main:app --reload --port=3001 --host 0.0.0.0` - -Navigate to [http://localhost:3001](http://localhost:3001) +# **Eatfast** +Eatfast is a website developed by ViaRézo for monitoring the waiting time in CROUS restaurants. <br/> -### *Le linter* -So the new commits can be deployed, you'll need to use the linter from backend : -`pycodestyle --config=./setup.cnf --exclude=./env ./` -You can use autoformat with autopep8 running : -`autopep8 --in-place --global-config=./setup.cnf --recursive --exclude=./env --aggressive ./` +## **Installation** +Use the template files in ./backend and ./frontend to define the configuration and environment variables. -<br/> +<br/> -## In production mode -Build the docker image : `docker-compose build` -Run the server, `docker-compose up -d` +### **In development mode** -<br/> +#### **Run the backend server** +Start the mysql container +`docker run -p 3306:3306 --env-file .env -d mysql:latest mysqld --default-authentication-plugin=mysql_native_password` +Build and start the tensorflow/serving container +`docker build -t model -f ./Dockerfile-model . && docker run -p 8501:8501 --env MODEL_NAME=model -d model` +Form ./backend, install the dependencies by executing `pip install -r requirements.txt` and run directly the uvicorn server : +`python -m uvicorn main:app --reload --port=3001 --host 0.0.0.0`. -# Run the client-side React app in a different terminal window: +<br/> -Using the template file, you first need to create frontend/.env. +#### **Run the frontend server** +Open a new terminal and run : ```sh $ cd frontend $ npm install -$ npm run start +$ npm start ``` -Navigate to [http://localhost:3000](http://localhost:3000) +<br/> -<br/> +### **In production mode** +From /backend execute `docker-compose build && docker-compose up -d`. +From /frontend run `npm run build` and serve the build generated. -# Documentation +<br/> -## Algorithm +## **Linting** +So the new commits can be deployed, you need to use the linter for the backend and the frontend. +To lint the backend code, run `pycodestyle --config=./setup.cnf ./backend`. To fix the errors, you can use autoformat with autopep8 running `autopep8 --in-place --global-config=./setup.cnf --recursive --aggressive ./`. If you use a virtual environment called env/ you should add `--exclude=./env` in both command so the linter ignore the folder. +To lint the frontend, run `npm run lint`. You can fix most of the errors using `npm run format`. -The crowd-counting AI model used is based on this repository: -https://github.com/ZhengPeng7/W-Net-Keras -The dataset used is ShanghaiTech Part B. -The model is given a 3-channel image and generates a density map of half the size of the input image. -The estimated number of people is obtained by summing on all pixels of the density map. +<br/> + +## **Contributing** +If you would like to contribute, contact us at support@ml.viarezo.fr. <br/> -# TODO -## Coté algo -- Accéder à d'autre infos telle que l'API des cours sur demande à la DISI pour intégrer ça aux prédictions (ex: cours en promo complète juste implique plus d'attente) - -## Coté dev -- Protéger l'interface OpenAPI et mettre en place une interface admin pour les news et potentiellement modération (avec authentification) -- Permettre de définir les masques proprement et de manière à pouvoir généraliser à d'autre RU -- Accorder la charte graphique si le service est intégré à d'autres appli (bordeau/blanc service de CS, charte graphique de VR) -- Réfléchir au système d'authentification, pour juste des commentaires l'authentification ViaRézo suffit mais CAS plus général dans les universités ou Shibboleth avec Renater - -## Coté camera et réseau -- Recherche d'un meilleur modèle de caméra par rapport aux contraintes réseau, d'angle de vue, de qualité d'image -- Démarches pour mettre en place les caméras et config réseau - -## Coté com et récolte des données -- Préparer la com pour la mise en place : mail NL, affiches, panneaux numérique DPIET -- Exploitation des données après récupération : visualisation et stratégie d'adaptation du modèle -- Réfléchir à un nom pour le service -- Motiver des gens à reprendre le projet - -## Documentation -- Documenter le projet au maximum -- Réfléchir à opensourcer (ça peut permettre d'étendre plus facilement à d'autre RU) - -## Déploiement -- Monitorer la VM de prod avec Datadog -- Écrire un rôle Ansible de déploiement en prod -- Monitorer la VM de staging avec Datadog -- Écrire un rôle Ansible de déploiement en staging +## **License** +The project doesn't have any license. However, the crowd-counting AI model used is based on this repository: +https://github.com/ZhengPeng7/W-Net-Keras. The dataset used is ShanghaiTech Part B. +The model is given a 3-channel image and generates a density map of half the size of the input image. +The estimated number of people is obtained by summing on all pixels of the density map. diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000000000000000000000000000000000000..961eb01d4e9c7b011723e742a56f410157f33aa4 --- /dev/null +++ b/TODO.md @@ -0,0 +1,26 @@ +# TODO +## Coté algo +- Accéder à d'autre infos telle que l'API des cours sur demande à la DISI pour intégrer ça aux prédictions (ex: cours en promo complète juste implique plus d'attente) + +## Coté dev +- Accorder la charte graphique si le service est intégré à d'autres appli (bordeau/blanc service de CS, charte graphique de VR) +- Réfléchir au système d'authentification, pour juste des commentaires l'authentification ViaRézo suffit mais CAS plus général dans les universités ou Shibboleth avec Renater + +## Coté camera et réseau +- Démarches pour mettre en place les caméras et config réseau + +## Coté com et récolte des données +- Préparer la com pour la mise en place : mail NL, affiches, panneaux numérique DPIET +- Exploitation des données après récupération : visualisation et stratégie d'adaptation du modèle +- Réfléchir à un nom pour le service +- Motiver des gens à reprendre le projet + +## Documentation +- Documenter le projet au maximum +- Réfléchir à opensourcer pour étendre plus facilement à d'autre RU + +## Déploiement +- Monitorer la VM de prod avec Datadog +- Écrire un rôle Ansible de déploiement en prod +- Monitorer la VM de staging avec Datadog +- Écrire un rôle Ansible de déploiement en staging