diff --git a/.gitignore b/.gitignore index 49b3cd2..27a6fd6 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,8 @@ __pycache__/ *.exe .idea + +config.json +/PDF-Summariser/config.json +**/config.json + diff --git a/PDF-Summariser/config.json b/PDF-Summariser/config.json index 5326954..1b4da40 100644 --- a/PDF-Summariser/config.json +++ b/PDF-Summariser/config.json @@ -9,11 +9,6 @@ "api_key": "ollama", "model": "phi4-mini", "base_url": "http://localhost:11434/v1" - }, - { - "api_key": "AIzaSyDl59DHeAiS07Z6g9tn-avjH_gxtsInhJg", - "model": "gemini-2.5-flash", - "base_url": "https://generativelanguage.googleapis.com/v1beta/openai/" } ] } diff --git a/README.fr.md b/README.fr.md index d33f39d..21c7a1b 100644 --- a/README.fr.md +++ b/README.fr.md @@ -1,53 +1,79 @@ # PDF Summariser 🤖📖 +# [README in english just here !](README.md) + +## Description -## Description **PDF Summariser** a pour objectif de résumer des fichiers PDF. L'application permet d'insérer des fichiers PDF, qui seront résumés en un maximum de 1400 mots, selon le choix de l'utilisateur. En outre, elle offre la possibilité de traduire les résumés en français, anglais ou allemand. +Le résumé généré peut être enregistré au format **doc** ou **txt**. +L’application inclut également un chatbot capable de répondre aux questions concernant le fichier PDF fourni ainsi que son résumé. + +### [Installation du projet pour le développement](#installation-du-projet-pour-le-développement) + --- ## Application -- **Téléchargez l'installeur** (Installer_PDF_Summariser.exe) et installer l'application pour la tester. +- **Téléchargez l'installeur** [ici depuis le lien Google Drive](https://drive.google.com/file/d/1BBQ5qoO_sjPhNBxgeVlztx5BLySdJlAA/view?usp=sharing) et installer l'application pour la tester. --- -## Fonctionnalités : -- **Résumé des fichiers PDF** : Résume les fichiers PDF en fonction des préférences de l'utilisateur (jusqu’à 1400 mots maximum). -- **Traduction multilingue** : Traduction des résumés en français, anglais ou allemand. -- **Stockage des modèles IA** : Les modèles IA sont stockés au format JSON dans l'application. -- **Thèmes** : L'application peut être dans un thème clair ou sombre. +## Fonctionnalités : ---- +- **Résumé des fichiers PDF** : Résume les fichiers PDF en fonction des préférences de l'utilisateur (jusqu’à 1400 mots maximum). +- **Traduction multilingue** : Traduction des résumés en français, anglais ou allemand. +- **Chatbot intégré** : Permet de poser des questions sur le contenu du PDF et son résumé, pour une exploration interactive de la documentation. +- **Export des résumés** : Enregistrement des résumés au format DOC (Word) ou TXT pour une conservation ou un partage facile. +- **Stockage des modèles IA** : Les modèles IA sont stockés et configurés au format JSON dans l'application, permettant l'utilisation de plusieurs fournisseurs (OpenAI, Google Gemini, Ollama, etc.). +- **Thèmes clairs et sombres** : L'interface propose un mode clair ou sombre, personnalisable pour un confort visuel optimal. +- **Interface intuitive** : Conçue avec Tkinter et ttkbootstrap pour une expérience utilisateur simple et agréable. +- **Installation facile** : Distribuée via un installeur Windows (.exe) créé avec InstallForge. +- **Téléchargement automatique du modèle Ollama** : si un modèle Ollama local est sélectionné, l'application télécharge et installe automatiquement le modèle requis. # Demo -![Demo d'un résumé en français](Demo/PDF-Summariser-demo.gif) +![Demo d'un résumé en français](doc/demo/resume-fr.gif) Démo d'un résumé en français -![Demo d'un résumé en anglais](Demo/PDF-Summariser-demo-ollama.gif) +![Demo d'un résumé en anglais](doc/demo/resume-en.gif) Démo d'un résumé en anglais -![Demo d'un résumé en allemand](Demo/PDF-Summariser-demo-deutsch.gif) +![Demo d'un résumé en allemand](/doc/archives/Demo/PDF-Summariser-demo-deutsch.gif) + +Démo d'un résumé en allemand (avec la version 1.0 de PDF Summerasier) + +![Demo du chatbot de résumé](/doc/demo/sumbot-fr.gif) -Démo d'un résumé en allemand +Démonstration du chatbot répondant aux questions basées sur le résumé du PDF. +Le bot facilite l'exploration interactive du document en répondant aux questions de l'utilisateur. -![Thème clair/sombre](Demo/PDF-Summariser-demo-themes.gif) +![Enregistrer un résumé en format txt](/doc/demo/enregistrer-txt.gif) + +Enregistrer un résumé en format txt + +![Enregistrer un résumé en format doc](/doc/demo/enregistrer-doc.gif) + +Enregistrer un résumé en format doc + +![Thème clair/sombre](doc/demo/themes.gif) Démonstration thème clair/sombre --- -## Apprentissage : -Ce projet m’a permis d’approfondir mes connaissances sur différents aspects : +## Apprentissage : + +Ce projet m’a permis d’approfondir mes connaissances sur différents aspects : + 1. **Manipulation des modèles IA** : J'ai appris à manipuler des modèles IA pour réaliser des tâches précises. -2. **Manipulation des fichiers en Python** : Exploration et gestion des fichiers PDF, avec compréhension approfondie des données. -3. **Stockage et gestion des données** : Utilisation de formats JSON pour stocker et manipuler les données. -4. **Interface utilisateur avec Tkinter** : Création d’une interface graphique conviviale avec **Tkinter** et **Ttkbootstrap**. -5. **Programmation orientée objet (POO)** : Utilisation de la POO pour structurer le code de manière plus modulaire et extensible. -6. **Installeur d’application** : Utilisation de **InstallForge** pour faciliter le déploiement. +2. **Manipulation des fichiers en Python** : Exploration et gestion des fichiers PDF, avec compréhension approfondie des données. +3. **Stockage et gestion des données** : Utilisation de formats JSON pour stocker et manipuler les données. +4. **Interface utilisateur avec Tkinter** : Création d’une interface graphique conviviale avec **Tkinter** et **Ttkbootstrap**. +5. **Programmation orientée objet (POO)** : Utilisation de la POO pour structurer le code de manière plus modulaire et extensible. +6. **Installeur d’application** : Utilisation de **InstallForge** pour faciliter le déploiement. **L’objectif principal** était d’accroître mes connaissances sur les modèles IA, leurs différentes marques et modèles (benchmark) et d'être capable de les manipuler afin de réaliser des tâches précises. @@ -55,74 +81,133 @@ Ce projet m’a permis d’approfondir mes connaissances sur différents aspects ## Utilisation -### Ollama -#### A noter : -Pour l'utilisation du modèle Llama 3.2, il faut avoir téléchargé **Ollama** en local, sinon le modèle ne fonctionnera pas. +### Ollama + +#### A noter : + +Pour l'utilisation du modèle Llama 3.2, il faut avoir téléchargé **Ollama** en local, sinon le modèle ne fonctionnera pas. -- **API KEY** : `ollama` (doit être rempli, mais n’est pas utilisé directement dans le code) -- **Nom du modèle** : `llama3.2` (par exemple) +- **API KEY** : `ollama` (doit être rempli, mais n’est pas utilisé directement dans le code) +- **Nom du modèle** : `llama3.2` (par exemple) - **Base URL** : `http://localhost:11434/v1` --- -### Google : -Vous pouvez utiliser une clé **Gemini** gratuite, disponible sur [https://ai.google.dev/](https://ai.google.dev/). -- **API KEY** : votre clé API -- **Nom du modèle** : `gemini-1.5-flash` (par exemple) +### Google : + +Vous pouvez utiliser une clé **Gemini** gratuite, disponible sur [https://ai.google.dev/](https://ai.google.dev/). + +- **API KEY** : votre clé API +- **Nom du modèle** : `gemini-1.5-flash` (par exemple) - **Base URL** : `https://generativelanguage.googleapis.com/v1beta/openai/` **Note** : Il est préférable d'utiliser le modèle `gemini-1.5-flash` plutôt que le modèle `gemini-1.5-flash-8b`, car ce dernier rencontre des difficultés à traduire les textes. --- -### OpenAI : +### OpenAI : + Il faut obtenir une clé sur [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys). -- **API KEY** : votre clé API -- **Nom du modèle** : `gpt-4o-mini` (par exemple) -- **Base URL** : laisser vide + +- **API KEY** : votre clé API +- **Nom du modèle** : `gpt-4o-mini` (par exemple) +- **Base URL** : laisser vide --- -### Autres modèles IA : +### Autres modèles IA : + Vous pouvez également insérer d'autres modèles IA, mais il est nécessaire de consulter leur documentation officielle pour savoir comment configurer leurs API clés et bases URL. --- -## Problèmes rencontrés : -- Les changements de langue ne fonctionnent parfois pas correctement selon le modèle IA choisi. -- Certains modèles d'IA peuvent rencontrer des difficultés à traduire les textes. -- Si vous utilisez les modèles Ollama en local, le temps de chargement peut varier, notamment en fonction du processeur que vous utilisez. +# Installation du projet pour le développement + +## 1. Créer et activer un environnement virtuel + +```bash +python -m venv .venv +``` + +Après, activez l'environement virtuel + +Sur Windows : + +```bash +python -m venv .venv +.\.venv\Scripts\activate +``` + +Sur Linux : + +```bash +python3 -m venv .venv +source .venv/bin/activate +``` + +## 2. Installer les dépendances Python + +```bash +pip install -r requirements.txt +``` + +## 3. Installer les outils externes + +Le projet nécessite trois outils externes : + +- **Ollama** +- **Poppler** +- **Tesseract-OCR** + +Vous avez deux possibilités : + +1. **Les installer directement sur votre PC** (méthode classique) +2. **OU** les placer **dans les dossiers du projet**, comme dans la version installée (.exe), + et suivre les instructions fournies dans chaque README dédié. + +Ainsi, si vous installez les outils sur votre machine, il n'y a **rien d'autre à faire**. +Si vous préférez les inclure dans le projet, vous devez suivre les instructions fournies dans les répertoires correspondants. --- -## Ce qui pourrait être amélioré : -- **Interface de gestion des modèles IA** : Une fenêtre permettant de voir et de configurer tous les modèles IA et leurs paramètres. -- Résolution du bogue mentionné précédemment. -- **Conservation des résumés** : Permettre de stocker les résumés pour un accès facile à l’avenir. -- **Prise en charge OCR pour les fichiers PDF** : La bibliothèque actuelle ne supporte pas les PDF scannés. -- Ajouter la possibilité pour la lecture des fichiers **Word** et **OCR**. -- Ajouter une interface graphique en anglais et en allemand -- Ajouter une requête **asynchrone** pour afficher le résumé de manière incrémentale, de sorte qu'une partie du texte soit affichée avant même que le résumé ne soit terminé, ce qui permet à l'utilisateur de commencer à lire sans attendre. -- Ajouter un tuto pour l'utilisateur. +### Installer Ollama + +Téléchargement : +https://ollama.com/ + +Instructions pour l’installer **dans le projet** : +[PDF-Summariser/Ollama/README.fr.md](/PDF-Summariser/Ollama/README.fr.md) --- -## A noter : -Au début, le code était en procédural et le modèle était stocké dans un .env, car je ne savais pas trop où j’allais et je testais. Ensuite, j’ai décidé de passer à une approche orientée objet lorsque j’ai vu que j’allais un peu plus loin. Cela permet d’avoir un code plus modulable et extensible. Je pourrais par exemple facilement ajouter des fonctionnalités supplémentaires. D’ailleurs, je ne pense pas modifier le code prochainement, mais si je le fais, j’envisage à l’avenir d’ajouter des fonctionnalités telles que la lecture de fichiers Word et la prise en charge de PDF OCR. J’aimerais également rajouter quelques fenêtres supplémentaires ainsi que quelques contrôles utilisateur. +### Installer Poppler + +Téléchargement : +https://github.com/oschwartz10612/poppler-windows/releases + +Instructions pour l’installer **dans le projet** : +[PDF-Summariser/poppler-24.08.0/README.fr.md](/PDF-Summariser/poppler-24.08.0/README.fr.md) --- -## Conclusion : -Malgré que l’application mérite quelque optimisations (que je n’aurais pas le temps de modifier à cause de l’école, j’ai des projets à rendre et des examens à faire), je suis très satisfait des compétences acquises, particulièrement en IA et l'utilisation InstallForge. InstallForge m'a en plus permis de comprendre indirectement quelques concepts systèmes très interessant que je ne connaissais pas encore. Je suis aussi content d'avoir utilisé Ttkboostrap pour faire le frontend, car j'aime et utilise déjà ce frontend pour les sites webs, même si je préfère largement l'utiliser en HTML, car je trouve la structure meilleure en HTML comparé à Python. +### Installer Tesseract-OCR + +Téléchargement : +https://digi.bib.uni-mannheim.de/tesseract/ + +Instructions pour l’installer **dans le projet** : +[PDF-Summariser/Tesseract-OCR/README.fr.md](/PDF-Summariser/Tesseract-OCR/README.fr.md) --- ## Remerciements + Merci à David De Groote, qui nous a donné un séminaire très intéressant sur l'IA à l'École d'Informatique de Gestion de Delémont. Grâce à ce cours, j'ai pu réaliser ce projet. Son GitBook est disponible dans les liens ci-dessous. --- ## Liens : + - [Installation Package OpenAI - ESIG](https://esig.degroote.ch/mardi-3-decembre-2024/pratique-api/installation-package-openai-et-test) - [OpenAI API Documentation](https://platform.openai.com/docs/api-reference/introduction) - [OpenAI Overview](https://platform.openai.com/docs/overview) diff --git a/README.md b/README.md index c10cb70..fffd5ad 100644 --- a/README.md +++ b/README.md @@ -1,54 +1,81 @@ -# PDF Summariser 🤖📖 +# PDF Summariser 🤖📖 # [Le README en français juste ici!](README.fr.md) -## Description +## Description + **PDF Summariser** is designed to summarize PDF files. The application lets you insert PDF files, which will be summarized in a maximum of 1400 words, according to the user's choice. It also offers the option of translating summaries into French, English or German. +The generated summary can be saved as a DOC or TXT file. +The application also includes a chatbot that can answer questions about the provided PDF and its generated summary. + +### [Project Installation for Development here](#project-installation-for-development) + --- ## Application -- **Download the installer** (Installer_PDF_Summariser.exe) and install the application to test it. +- **Download the installer** **Téléchargez l'installeur** [here with this link to Google Drive](https://drive.google.com/file/d/1BBQ5qoO_sjPhNBxgeVlztx5BLySdJlAA/view?usp=sharing) and install the application to test it. --- -## Features : -- **PDF file summary** : Summarizes PDF files according to user preferences (up to 1400 words). -- **Multilingual translation** : Translation of summaries into French, English or German. -- **IA template storage** : IA templates are stored in JSON format within the application. -- **Themes** : The application can be in a light or dark theme. +## Features : + +- **PDF file summary** : Summarizes PDF files according to user preferences (up to 1400 words). +- **Multilingual translation** : Translation of summaries into French, English or German. +- **Integrated chatbot** : Allows asking questions about the PDF content and its summary for interactive exploration. +- **Summary export** : Save summaries in DOC (Word) or TXT formats for easy storage and sharing. +- **IA template storage** : IA models are stored and configured in JSON format within the application, supporting multiple providers (OpenAI, Google Gemini, Ollama, etc.). +- **Light and dark themes** : The interface offers customizable light and dark modes for optimal viewing comfort. +- **User-friendly interface** : Built with Tkinter and ttkbootstrap for a simple and pleasant user experience. +- **Easy installation** : Distributed via a Windows installer (.exe) created with InstallForge. +- **Automatic download of Ollama template**: if a local Ollama template is selected, the application automatically downloads and installs the required template. --- # Demo -![French text summary demo](Demo/PDF-Summariser-demo.gif) +![French text summary demo](/doc/demo/resume-fr.gif/) French summary demo -![English text summary demo](Demo/PDF-Summariser-demo-ollama.gif) +![English text summary demo](/doc/demo/resume-en.gif) English summary demo -![German text summary demo](Demo/PDF-Summariser-demo-deutsch.gif) +![German text summary demo](/doc/archives/Demo/PDF-Summariser-demo-deutsch.gif) + +German summary demo (with the 1.0 version of PDF Summerasier) + +![Sumbot text summary demo](/doc/demo/sumbot-en.gif) + +Demo of the chatbot answering questions based on the summarized PDF content. +The bot helps explore the document interactively by responding to user queries. + +![Save a summary as txt](/doc/demo/download-txt.gif) + +Save a summary in txt format -German summary demo +![Save a summary as doc](/doc/demo/download-doc.gif) -![Theme light/dark](Demo/PDF-Summariser-demo-themes.gif) +Save a summary in doc format + +![Theme light/dark](/doc/demo/themes.gif) Demonstration of light/dark theme --- -## Learning: -This project has enabled me to deepen my knowledge on various aspects: -1. **AI model manipulation** : I learned how to manipulate AI models, as well as how to use them. -2. **File manipulation in Python** : Exploration and management of PDF files, with in-depth understanding of the data. -3. **Data storage and management** : Use of JSON formats to store and manipulate data. -4. User interface with Tkinter** : Create a user-friendly graphical interface with **Tkinter** and *Tkinter**. -5. **Object-oriented programming (OOP)** : Using OOP to structure code in a more modular and extensible way. -6. **Application installer**: Use of **InstallForge** to facilitate deployment. +## Learning: + +This project has enabled me to deepen my knowledge on various aspects: + +1. **AI model manipulation** : I learned how to manipulate AI models, as well as how to use them. +2. **File manipulation in Python** : Exploration and management of PDF files, with in-depth understanding of the data. +3. **Data storage and management** : Use of JSON formats to store and manipulate data. +4. **User interface with Tkinter** : Create a user-friendly graphical interface with **Tkinter** and \*Tkinter\*\*. +5. **Object-oriented programming (OOP)** : Using OOP to structure code in a more modular and extensible way. +6. **Application installer**: Use of **InstallForge** to facilitate deployment. **The main objective** was to increase my knowledge of AI models, their different brands and models (benchmark). @@ -56,71 +83,99 @@ This project has enabled me to deepen my knowledge on various aspects: ## Use -### Ollama -#### Please note: -To use the Llama 3.2 model, you need to have downloaded **Ollama** locally, otherwise the model won't work. +### Ollama + +#### Please note: -- **API KEY** : `ollama` (must be filled in, but is not used directly in the code) -- **Template name**: `llama3.2` (for example) +To use the Llama 3.2 model, you need to have downloaded **Ollama** locally, otherwise the model won't work. + +- **API KEY** : `ollama` (must be filled in, but is not used directly in the code) +- **Template name**: `llama3.2` (for example) - **Base URL**: `http://localhost:11434/v1` --- -### Google: -You can use a free **Gemini** key, available at [https://ai.google.dev/](https://ai.google.dev/). -- **API KEY** : your API key -- **Model name** : `gemini-1.5-flash` (for example) +### Google: + +You can use a free **Gemini** key, available at [https://ai.google.dev/](https://ai.google.dev/). + +- **API KEY** : your API key +- **Model name** : `gemini-1.5-flash` (for example) - **Base URL**: `https://generativelanguage.googleapis.com/v1beta/openai/` --- -### OpenAI: +### OpenAI: + You need to get a key from [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys). -- **API KEY** : your API key -- **Model name** : `gpt-4o-mini` (for example) -- **Base URL** : leave empty + +- **API KEY** : your API key +- **Model name** : `gpt-4o-mini` (for example) +- **Base URL** : leave empty --- -### Other IA templates : +### Other IA templates : + You can also insert other IA templates, but you'll need to consult their official documentation to find out how to configure their API keys and URL bases. ---- +# Project Installation for Development -## Problems encountered: -- Language changes may not work correctly depending on the AI model selected. -- Some AI models may have difficulty translating text. -- If you use Ollama models locally, loading times may vary, depending on the processor you're using. +## 1. Create and activate a virtual environment ---- +```bash +python -m venv .venv +``` -## What could be improved : -- **AI template management interface** : A window for viewing and configuring all AI templates and their settings. -- Resolution of the above-mentioned bug. -- **Summary storage** : Enable summaries to be stored for easy access in the future. -- **OCR support for PDF files** : The current library does not support scanned PDFs. -- Add the ability to read Word and OCR files. -- Add a GUI in English and German. -- Add an **asynchronous** request to display the summary incrementally, so part of the text is shown even before the summarization is complete, allowing the user to start reading without waiting. +Then activate the virtual environment ---- -## Please note: -At first, the code was procedural and the template was stored in an .env, as I wasn't sure where I was going and was testing. Then I decided to switch to an object-oriented approach when I saw that I was going a bit further. This meant that the code was more modular and extensible. For example, I could easily add extra functionality. In fact, I don't think I'll be modifying the code any time soon, but if I do, I plan to add features such as Word file reading and PDF OCR support in the future. I'd also like to add a few more windows and some user controls. -The procedural code is available in the pdf-summariser-procedural folder. +On Windows : ---- +```bash +python -m venv .venv +.\.venv\Scripts\activate +``` + +On Linux : + +```bash +python3 -m venv .venv +source .venv/bin/activate +``` + +## 2. Install Python dependencies -## Conclusion : -Despite the fact that the application needs a few optimizations (which I won't have time to modify because of school, I have projects to hand in and exams to do), I'm very satisfied with the skills I've acquired, particularly in AI and the use of InstallForge. InstallForge has also enabled me to indirectly understand some very interesting system concepts that I didn't know before. I'm also glad I used Ttkboostrap for the frontend, as I already like and use this frontend for websites, even if I much prefer to use it in HTML, as I find the structure better in HTML than in Python. +```bash +pip install -r requirements.txt +``` + +## 3. Install external tools + +The project requires three external tools: + +- **Ollama** +- **Poppler** +- **Tesseract-OCR** + +You have two options: + +1. **Install them directly on your PC** (classic method) +2. **OR** place them **inside the project folders**, as in the packaged (.exe) version, + and follow the instructions provided in each dedicated README. + +If you install the tools on your system, **nothing else needs to be done**. +If you prefer to include them in the project, you must follow the setup instructions found in the corresponding directories. --- ## Thanks + Thanks to David De Groote, who gave us a very interesting seminar on AI at the "École d'Informatique de Gestion" in Delémont (School of Business Information Technology or School of Business Informatics, in english according to deepl and chatgpt). Thanks to this course, I was able to realize this project. His GitBook is available in the links below. --- ## Links : + - [Installation Package OpenAI - ESIG](https://esig.degroote.ch/mardi-3-decembre-2024/pratique-api/installation-package-openai-et-test) - [OpenAI API Documentation](https://platform.openai.com/docs/api-reference/introduction) - [OpenAI Overview](https://platform.openai.com/docs/overview) diff --git a/Demo/PDF-Summariser-demo-deutsch.gif b/doc/archives/Demo/PDF-Summariser-demo-deutsch.gif similarity index 100% rename from Demo/PDF-Summariser-demo-deutsch.gif rename to doc/archives/Demo/PDF-Summariser-demo-deutsch.gif diff --git a/Demo/PDF-Summariser-demo-ollama.gif b/doc/archives/Demo/PDF-Summariser-demo-ollama.gif similarity index 100% rename from Demo/PDF-Summariser-demo-ollama.gif rename to doc/archives/Demo/PDF-Summariser-demo-ollama.gif diff --git a/Demo/PDF-Summariser-demo-themes.gif b/doc/archives/Demo/PDF-Summariser-demo-themes.gif similarity index 100% rename from Demo/PDF-Summariser-demo-themes.gif rename to doc/archives/Demo/PDF-Summariser-demo-themes.gif diff --git a/Demo/PDF-Summariser-demo.gif b/doc/archives/Demo/PDF-Summariser-demo.gif similarity index 100% rename from Demo/PDF-Summariser-demo.gif rename to doc/archives/Demo/PDF-Summariser-demo.gif diff --git a/doc/archives/README.fr.md b/doc/archives/README.fr.md new file mode 100644 index 0000000..d33f39d --- /dev/null +++ b/doc/archives/README.fr.md @@ -0,0 +1,147 @@ +# PDF Summariser 🤖📖 + + +## Description +**PDF Summariser** a pour objectif de résumer des fichiers PDF. L'application permet d'insérer des fichiers PDF, qui seront résumés en un maximum de 1400 mots, selon le choix de l'utilisateur. En outre, elle offre la possibilité de traduire les résumés en français, anglais ou allemand. + +--- + +## Application + +- **Téléchargez l'installeur** (Installer_PDF_Summariser.exe) et installer l'application pour la tester. + +--- + +## Fonctionnalités : +- **Résumé des fichiers PDF** : Résume les fichiers PDF en fonction des préférences de l'utilisateur (jusqu’à 1400 mots maximum). +- **Traduction multilingue** : Traduction des résumés en français, anglais ou allemand. +- **Stockage des modèles IA** : Les modèles IA sont stockés au format JSON dans l'application. +- **Thèmes** : L'application peut être dans un thème clair ou sombre. + +--- + +# Demo + +![Demo d'un résumé en français](Demo/PDF-Summariser-demo.gif) + +Démo d'un résumé en français + +![Demo d'un résumé en anglais](Demo/PDF-Summariser-demo-ollama.gif) + +Démo d'un résumé en anglais + +![Demo d'un résumé en allemand](Demo/PDF-Summariser-demo-deutsch.gif) + +Démo d'un résumé en allemand + +![Thème clair/sombre](Demo/PDF-Summariser-demo-themes.gif) + +Démonstration thème clair/sombre + +--- + +## Apprentissage : +Ce projet m’a permis d’approfondir mes connaissances sur différents aspects : +1. **Manipulation des modèles IA** : J'ai appris à manipuler des modèles IA pour réaliser des tâches précises. +2. **Manipulation des fichiers en Python** : Exploration et gestion des fichiers PDF, avec compréhension approfondie des données. +3. **Stockage et gestion des données** : Utilisation de formats JSON pour stocker et manipuler les données. +4. **Interface utilisateur avec Tkinter** : Création d’une interface graphique conviviale avec **Tkinter** et **Ttkbootstrap**. +5. **Programmation orientée objet (POO)** : Utilisation de la POO pour structurer le code de manière plus modulaire et extensible. +6. **Installeur d’application** : Utilisation de **InstallForge** pour faciliter le déploiement. + +**L’objectif principal** était d’accroître mes connaissances sur les modèles IA, leurs différentes marques et modèles (benchmark) et d'être capable de les manipuler afin de réaliser des tâches précises. + +--- + +## Utilisation + +### Ollama +#### A noter : +Pour l'utilisation du modèle Llama 3.2, il faut avoir téléchargé **Ollama** en local, sinon le modèle ne fonctionnera pas. + +- **API KEY** : `ollama` (doit être rempli, mais n’est pas utilisé directement dans le code) +- **Nom du modèle** : `llama3.2` (par exemple) +- **Base URL** : `http://localhost:11434/v1` + +--- + +### Google : +Vous pouvez utiliser une clé **Gemini** gratuite, disponible sur [https://ai.google.dev/](https://ai.google.dev/). +- **API KEY** : votre clé API +- **Nom du modèle** : `gemini-1.5-flash` (par exemple) +- **Base URL** : `https://generativelanguage.googleapis.com/v1beta/openai/` + +**Note** : Il est préférable d'utiliser le modèle `gemini-1.5-flash` plutôt que le modèle `gemini-1.5-flash-8b`, car ce dernier rencontre des difficultés à traduire les textes. + +--- + +### OpenAI : +Il faut obtenir une clé sur [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys). +- **API KEY** : votre clé API +- **Nom du modèle** : `gpt-4o-mini` (par exemple) +- **Base URL** : laisser vide + +--- + +### Autres modèles IA : +Vous pouvez également insérer d'autres modèles IA, mais il est nécessaire de consulter leur documentation officielle pour savoir comment configurer leurs API clés et bases URL. + +--- + +## Problèmes rencontrés : +- Les changements de langue ne fonctionnent parfois pas correctement selon le modèle IA choisi. +- Certains modèles d'IA peuvent rencontrer des difficultés à traduire les textes. +- Si vous utilisez les modèles Ollama en local, le temps de chargement peut varier, notamment en fonction du processeur que vous utilisez. + +--- + +## Ce qui pourrait être amélioré : +- **Interface de gestion des modèles IA** : Une fenêtre permettant de voir et de configurer tous les modèles IA et leurs paramètres. +- Résolution du bogue mentionné précédemment. +- **Conservation des résumés** : Permettre de stocker les résumés pour un accès facile à l’avenir. +- **Prise en charge OCR pour les fichiers PDF** : La bibliothèque actuelle ne supporte pas les PDF scannés. +- Ajouter la possibilité pour la lecture des fichiers **Word** et **OCR**. +- Ajouter une interface graphique en anglais et en allemand +- Ajouter une requête **asynchrone** pour afficher le résumé de manière incrémentale, de sorte qu'une partie du texte soit affichée avant même que le résumé ne soit terminé, ce qui permet à l'utilisateur de commencer à lire sans attendre. +- Ajouter un tuto pour l'utilisateur. + +--- + +## A noter : +Au début, le code était en procédural et le modèle était stocké dans un .env, car je ne savais pas trop où j’allais et je testais. Ensuite, j’ai décidé de passer à une approche orientée objet lorsque j’ai vu que j’allais un peu plus loin. Cela permet d’avoir un code plus modulable et extensible. Je pourrais par exemple facilement ajouter des fonctionnalités supplémentaires. D’ailleurs, je ne pense pas modifier le code prochainement, mais si je le fais, j’envisage à l’avenir d’ajouter des fonctionnalités telles que la lecture de fichiers Word et la prise en charge de PDF OCR. J’aimerais également rajouter quelques fenêtres supplémentaires ainsi que quelques contrôles utilisateur. + +--- + +## Conclusion : +Malgré que l’application mérite quelque optimisations (que je n’aurais pas le temps de modifier à cause de l’école, j’ai des projets à rendre et des examens à faire), je suis très satisfait des compétences acquises, particulièrement en IA et l'utilisation InstallForge. InstallForge m'a en plus permis de comprendre indirectement quelques concepts systèmes très interessant que je ne connaissais pas encore. Je suis aussi content d'avoir utilisé Ttkboostrap pour faire le frontend, car j'aime et utilise déjà ce frontend pour les sites webs, même si je préfère largement l'utiliser en HTML, car je trouve la structure meilleure en HTML comparé à Python. + +--- + +## Remerciements +Merci à David De Groote, qui nous a donné un séminaire très intéressant sur l'IA à l'École d'Informatique de Gestion de Delémont. Grâce à ce cours, j'ai pu réaliser ce projet. Son GitBook est disponible dans les liens ci-dessous. + +--- + +## Liens : +- [Installation Package OpenAI - ESIG](https://esig.degroote.ch/mardi-3-decembre-2024/pratique-api/installation-package-openai-et-test) +- [OpenAI API Documentation](https://platform.openai.com/docs/api-reference/introduction) +- [OpenAI Overview](https://platform.openai.com/docs/overview) +- [openai-python GitHub Repository](https://github.com/openai/openai-python) +- [Ollama](https://ollama.com/) +- [python-json-config sur PyPI](https://pypi.org/project/python-json-config/) +- [Append to JSON file using Python - GeeksforGeeks](https://www.geeksforgeeks.org/append-to-json-file-using-python/) +- [Tkinter messagebox Documentation](https://docs.python.org/3/library/tkinter.messagebox.html) +- [PyPDF GitHub Repository](https://github.com/py-pdf/pypdf) +- [PDF Reader Tutorial](https://pdfreader.readthedocs.io/en/latest/tutorial.html) +- [Classes et Objets - Courspython](https://courspython.com/classes-et-objets.html) +- [Tkinter Dark/Light Theme Switching - YouTube](https://www.youtube.com/watch?v=PIaccbMT6fo) +- [ttkbootstrap Documentation](https://ttkbootstrap.readthedocs.io) +- [ttkbootstrap GitHub Repository](https://github.com/israel-dryer/ttkbootstrap) +- [Centering a Window on the Screen in Tkinter - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-center-a-window-on-the-screen-in-tkinter/) +- [Tkinter Checkbutton Widget - GeeksforGeeks](https://www.geeksforgeeks.org/python-tkinter-checkbutton-widget/) +- [Close a Tkinter Window with a Button - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-close-a-tkinter-window-with-a-button/) +- [Switch between Dark and Light ttk Theme - Stack Overflow](https://stackoverflow.com/questions/66576662/how-to-switch-between-dark-and-light-ttk-theme) +- [Tkinter Separator - Python Tutorial](https://www.pythontutorial.net/tkinter/tkinter-separator/) +- [Tkinter Anchors - TutorialsPoint](https://www.tutorialspoint.com/python/tk_anchors.htm) +- [Tkinter ttk Documentation](https://docs.python.org/fr/3.13/library/tkinter.ttk.html) +- Logo Source: [Livres - Flaticon](https://www.flaticon.com/fr/chercher?word=livre) diff --git a/doc/archives/README.md b/doc/archives/README.md new file mode 100644 index 0000000..1a5ca94 --- /dev/null +++ b/doc/archives/README.md @@ -0,0 +1,163 @@ +# PDF Summariser 🤖📖 + +# [Le README en français juste ici!](README.fr.md) + +## Description + +**PDF Summariser** is designed to summarize PDF files. The application lets you insert PDF files, which will be summarized in a maximum of 1400 words, according to the user's choice. It also offers the option of translating summaries into French, English or German. + +--- + +## Application + +- **Download the installer** (Installer_PDF_Summariser.exe) and install the application to test it. + +--- + +## Features : + +- **PDF file summary** : Summarizes PDF files according to user preferences (up to 1400 words). +- **Multilingual translation** : Translation of summaries into French, English or German. +- **IA template storage** : IA templates are stored in JSON format within the application. +- **Themes** : The application can be in a light or dark theme. + +--- + +# Demo + +![French text summary demo](Demo/PDF-Summariser-demo.gif) + +French summary demo + +![English text summary demo](Demo/PDF-Summariser-demo-ollama.gif) + +English summary demo + +![German text summary demo](Demo/PDF-Summariser-demo-deutsch.gif) + +German summary demo + +![Theme light/dark](Demo/PDF-Summariser-demo-themes.gif) + +Demonstration of light/dark theme + +--- + +## Learning: + +This project has enabled me to deepen my knowledge on various aspects: + +1. **AI model manipulation** : I learned how to manipulate AI models, as well as how to use them. +2. **File manipulation in Python** : Exploration and management of PDF files, with in-depth understanding of the data. +3. **Data storage and management** : Use of JSON formats to store and manipulate data. +4. User interface with Tkinter** : Create a user-friendly graphical interface with **Tkinter** and \*Tkinter**. +5. **Object-oriented programming (OOP)** : Using OOP to structure code in a more modular and extensible way. +6. **Application installer**: Use of **InstallForge** to facilitate deployment. + +**The main objective** was to increase my knowledge of AI models, their different brands and models (benchmark). + +--- + +## Use + +### Ollama + +#### Please note: + +To use the Llama 3.2 model, you need to have downloaded **Ollama** locally, otherwise the model won't work. + +- **API KEY** : `ollama` (must be filled in, but is not used directly in the code) +- **Template name**: `llama3.2` (for example) +- **Base URL**: `http://localhost:11434/v1` + +--- + +### Google: + +You can use a free **Gemini** key, available at [https://ai.google.dev/](https://ai.google.dev/). + +- **API KEY** : your API key +- **Model name** : `gemini-1.5-flash` (for example) +- **Base URL**: `https://generativelanguage.googleapis.com/v1beta/openai/` + +--- + +### OpenAI: + +You need to get a key from [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys). + +- **API KEY** : your API key +- **Model name** : `gpt-4o-mini` (for example) +- **Base URL** : leave empty + +--- + +### Other IA templates : + +You can also insert other IA templates, but you'll need to consult their official documentation to find out how to configure their API keys and URL bases. + +--- + +## Problems encountered: + +- Language changes may not work correctly depending on the AI model selected. +- Some AI models may have difficulty translating text. +- If you use Ollama models locally, loading times may vary, depending on the processor you're using. + +--- + +## What could be improved : + +- **AI template management interface** : A window for viewing and configuring all AI templates and their settings. +- Resolution of the above-mentioned bug. +- **Summary storage** : Enable summaries to be stored for easy access in the future. +- **OCR support for PDF files** : The current library does not support scanned PDFs. +- Add the ability to read Word and OCR files. +- Add a GUI in English and German. +- Add an **asynchronous** request to display the summary incrementally, so part of the text is shown even before the summarization is complete, allowing the user to start reading without waiting. + +--- + +## Please note: + +At first, the code was procedural and the template was stored in an .env, as I wasn't sure where I was going and was testing. Then I decided to switch to an object-oriented approach when I saw that I was going a bit further. This meant that the code was more modular and extensible. For example, I could easily add extra functionality. In fact, I don't think I'll be modifying the code any time soon, but if I do, I plan to add features such as Word file reading and PDF OCR support in the future. I'd also like to add a few more windows and some user controls. +The procedural code is available in the pdf-summariser-procedural folder. + +--- + +## Conclusion : + +Despite the fact that the application needs a few optimizations (which I won't have time to modify because of school, I have projects to hand in and exams to do), I'm very satisfied with the skills I've acquired, particularly in AI and the use of InstallForge. InstallForge has also enabled me to indirectly understand some very interesting system concepts that I didn't know before. I'm also glad I used Ttkboostrap for the frontend, as I already like and use this frontend for websites, even if I much prefer to use it in HTML, as I find the structure better in HTML than in Python. + +--- + +## Thanks + +Thanks to David De Groote, who gave us a very interesting seminar on AI at the "École d'Informatique de Gestion" in Delémont (School of Business Information Technology or School of Business Informatics, in english according to deepl and chatgpt). Thanks to this course, I was able to realize this project. His GitBook is available in the links below. + +--- + +## Links : + +- [Installation Package OpenAI - ESIG](https://esig.degroote.ch/mardi-3-decembre-2024/pratique-api/installation-package-openai-et-test) +- [OpenAI API Documentation](https://platform.openai.com/docs/api-reference/introduction) +- [OpenAI Overview](https://platform.openai.com/docs/overview) +- [openai-python GitHub Repository](https://github.com/openai/openai-python) +- [Ollama](https://ollama.com/) +- [python-json-config sur PyPI](https://pypi.org/project/python-json-config/) +- [Append to JSON file using Python - GeeksforGeeks](https://www.geeksforgeeks.org/append-to-json-file-using-python/) +- [Tkinter messagebox Documentation](https://docs.python.org/3/library/tkinter.messagebox.html) +- [PyPDF GitHub Repository](https://github.com/py-pdf/pypdf) +- [PDF Reader Tutorial](https://pdfreader.readthedocs.io/en/latest/tutorial.html) +- [Classes et Objets - Courspython](https://courspython.com/classes-et-objets.html) +- [Tkinter Dark/Light Theme Switching - YouTube](https://www.youtube.com/watch?v=PIaccbMT6fo) +- [ttkbootstrap Documentation](https://ttkbootstrap.readthedocs.io) +- [ttkbootstrap GitHub Repository](https://github.com/israel-dryer/ttkbootstrap) +- [Centering a Window on the Screen in Tkinter - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-center-a-window-on-the-screen-in-tkinter/) +- [Tkinter Checkbutton Widget - GeeksforGeeks](https://www.geeksforgeeks.org/python-tkinter-checkbutton-widget/) +- [Close a Tkinter Window with a Button - GeeksforGeeks](https://www.geeksforgeeks.org/how-to-close-a-tkinter-window-with-a-button/) +- [Switch between Dark and Light ttk Theme - Stack Overflow](https://stackoverflow.com/questions/66576662/how-to-switch-between-dark-and-light-ttk-theme) +- [Tkinter Separator - Python Tutorial](https://www.pythontutorial.net/tkinter/tkinter-separator/) +- [Tkinter Anchors - TutorialsPoint](https://www.tutorialspoint.com/python/tk_anchors.htm) +- [Tkinter ttk Documentation](https://docs.python.org/fr/3.13/library/tkinter.ttk.html) +- Logo Source: [Livres - Flaticon](https://www.flaticon.com/fr/chercher?word=livre) diff --git a/doc/demo/download-doc.gif b/doc/demo/download-doc.gif new file mode 100644 index 0000000..7010c4b Binary files /dev/null and b/doc/demo/download-doc.gif differ diff --git a/doc/demo/download-txt.gif b/doc/demo/download-txt.gif new file mode 100644 index 0000000..34f9ebb Binary files /dev/null and b/doc/demo/download-txt.gif differ diff --git a/doc/demo/enregistrer-doc.gif b/doc/demo/enregistrer-doc.gif new file mode 100644 index 0000000..4b33de8 Binary files /dev/null and b/doc/demo/enregistrer-doc.gif differ diff --git a/doc/demo/enregistrer-txt.gif b/doc/demo/enregistrer-txt.gif new file mode 100644 index 0000000..419088b Binary files /dev/null and b/doc/demo/enregistrer-txt.gif differ diff --git a/doc/demo/resume-en.gif b/doc/demo/resume-en.gif new file mode 100644 index 0000000..bafa673 Binary files /dev/null and b/doc/demo/resume-en.gif differ diff --git a/doc/demo/resume-fr.gif b/doc/demo/resume-fr.gif new file mode 100644 index 0000000..b0755d1 Binary files /dev/null and b/doc/demo/resume-fr.gif differ diff --git a/doc/demo/sumbot-en.gif b/doc/demo/sumbot-en.gif new file mode 100644 index 0000000..75b09db Binary files /dev/null and b/doc/demo/sumbot-en.gif differ diff --git a/doc/demo/sumbot-fr.gif b/doc/demo/sumbot-fr.gif new file mode 100644 index 0000000..ac3d818 Binary files /dev/null and b/doc/demo/sumbot-fr.gif differ diff --git a/doc/demo/themes.gif b/doc/demo/themes.gif new file mode 100644 index 0000000..188888c Binary files /dev/null and b/doc/demo/themes.gif differ