AOSSIE-Org / AOSSIE-Org/PictoPy

Feat: Option to remove wrong AI image tagging.

Aperta
#1,168 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
283
Fork
679
Merge medio
7g 2h
PR unite (30g)
3

Descrizione

### Describe the feature

### Description
The AI tagging of the images in PictoPy are sometimes wrong. There should be a feature to remove the wrong AI tagging so that user have an option to remove that tag.

### Current Feature
- Image show AI tags but they don't have option to remove it.

### Expected Feature
- Tags should have option to remove it. This option should be visible when we hover on it.

### Implementation
- **`Backend`** :
- Created a delete route with parameters for `tag name` and `image id.`
- Get `class_id` from **mapping** (Database) with the help of `tag name`.
- With the help of `image_id` and `class_id` we can remove the tagging from **image_classes**.
- **`Frontend`** :
- Added the delete endpoint to `apiEndpoints.ts` and created an asynchronous function using `Axios` to handle the `DELETE` request to the backend.
- Implemented a reducer in `imageSlice.ts` that filters out the deleted tag from the `Redux` store, ensuring the UI reflects the change immediately without a page refresh.
- Linked the tag removal logic to the `ImageTags` (home gallery) and `MediaInfoPanel` (image details) components, passing necessary imageId props to trigger deletions.
- Added an "X" button to each tag that stops click propagation to prevent opening the image and includes a loading state to disable multiple clicks during the deletion process.

### Add ScreenShots

### Screenshots
- API working properly.

Image

- Wrong AI tagging. ( no frisbee in image ) and there is not any option to remove the tagging.

![Image](https://github.com/user-attachments/assets/704b0e07-9a67-4ef0-a9c3-d559d44c7257)

- Added an option to remove the tags.

![Image](https://github.com/user-attachments/assets/901b65ce-c2ba-4adc-ad0f-a5e63b4ebd37)

- Tag removed on clicking the "X" icon.

![Image](https://github.com/user-attachments/assets/1acc5918-fea3-4aa2-a8f3-7b71fd9da998)

- Tags with option to remove is also visible in Media Info.

![Image](https://github.com/user-attachments/assets/ab80a35b-2983-4652-86ca-0d7313ddb8c7)

### Record

- [x] I agree to follow this project's Code of Conduct
- [x] I want to work on this issue

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.