Image Classificator is a web application that allows users to upload images and classify them using pre-trained models. The application consists of three main components: an API, a server, and a client. The API is built using Node.js and Express, the server is built using Python and gRPC, and the client is built using React and Vite.
The idea behind the application is to create a web-application to classify image were the web server is separated from the image classification server. This separation allows the web server to be lightweight and handle multiple requests without being overloaded. The image classification server on the other hand can be optimized for image processing and classification.
.
├── Api
│ ├── config
│ ├── migrations
│ ├── models
│ ├── protos
│ ├── public
│ │ └── images
│ ├── seeders
│ └── src
│ ├── __tests__
│ ├── middlewares
│ ├── routes
│ ├── services
│ └── utils
├── Server
│ ├── data
│ │ ├── images
│ │ └── models
│ ├── proto
│ └── src
│ ├── generated
│ └── service
├── Client
│ ├── public
│ └── src
│ ├── assets
│ ├── components
│ │ └── Header
│ ├── layout
│ ├── pages
│ ├── providers
│ └── store
├── docker-compose.yml
└── README.md
-
API: The API is built using Node.js and Express. It operates as a RESTful API to handle everything related to the application's data. It uses PostgreSQL as the database and Sequelize as the ORM to store the users' data. The API also uses JWT for authentication and authorization. When a user uploads an image, the API sends the image to the server using gRPC. The server then classifies the image and sends the result back to the API which transmits it to the client.
-
Server: The server is built using Python and gRPC. It uses pre-trained models to classify the images. The server receives the image from the API, processes it, and sends the result back to the API. Every file uploaded to the server are stored for future use and the associated request and response are saved in MongoDB.
-
Client: The client is built using React and Vite. It allows users to upload images and view the classification results. The client also allows users to choose the model to use for classification and download preview images.
- Clone the repository.
- Run the following command to start the application:
docker-compose --profile tools up- Access the application at
http://localhost/image-classificator/. - Access the API documentation at
http://localhost:3000/api-docs.
To run the application without running the migrations again, use the following command:
docker-compose up- Clone the repository.
- Install PostgreSQL and create a database.
- Create a
.envfile in theApidirectory and add the following environment variables:DEV_DB_USERNAME=your_username DEV_DB_PASSWORD=your_password DEV_DB_NAME=your_database_name DEV_DB_HOST=localhost JWT_SECRET=secret GRPC_HOST=localhost GRPC_PORT=9090
- Create a
.envfile in theClientdirectory and add the following environment variables:VITE_API_URL=http://localhost:3000
- Install the dependencies for the API:
cd Api npm install - Run the migrations:
npm run init
- Install the dependencies for the Server:
cd Server pip install -r requirements.txt - Generate the gRPC files (optional):
bash generate.sh
- Install the dependencies for the Client:
cd Client npm install - Start the Server:
cd Server python src/main.py - Start the API:
cd Api npm run start:dev - Start the Client:
cd Client npm run dev - Access the application at
http://localhost/image-classificator/. - Access the API documentation at
http://localhost:3000/api-docs.
To run the tests for the API, use the following command:
cd Api
npm run testThe API documentation is available at http://localhost:3000/api-docs. A live instance of the documentation is available on GitHub Pages.
Les contributions sont les bienvenues ! Veuillez suivre les étapes ci-dessous pour contribuer :
- Forkez le dépôt.
- Créez une branche pour votre fonctionnalité (
git checkout -b ma-fonctionnalité). - Commitez vos modifications (
git commit -am 'Ajoutez une nouvelle fonctionnalité'). - Poussez votre branche (
git push origin ma-fonctionnalité). - Ouvrez une Pull Request.
Ce projet est sous licence Apache 2.0. Voir le fichier LICENSE pour plus d'informations.