Metadata-Version: 2.2
Name: BmpLib_Ai
Version: 0.0.9
Summary: This package implements all the logic of Brief My Press.AI
Author-email: OUEDRAOGO Taoufiq <taoufiq.ouedraogo@icloud.com>
License: Copyright (c) 2018 The Python Packaging Authority
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Project-URL: Homepage, https://github.com/Taoufiq-Ouedraogo/Brief-My-Press-AI-Library
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: <3.11,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: setuptools
Requires-Dist: wheel
Requires-Dist: twine
Requires-Dist: ipywidgets
Requires-Dist: transformers
Requires-Dist: openai
Requires-Dist: python-dotenv
Requires-Dist: spacy
Requires-Dist: gTTS
Requires-Dist: pandas
Requires-Dist: ipykernel
Requires-Dist: requests
Requires-Dist: openpyxl
Requires-Dist: mlx-lm
Requires-Dist: mlx

# BmpLib-Ai

**BmpLib-Ai** est une bibliothèque Python intelligente et sur-mesure conçue pour simplifier et enrichir la consommation de contenu de presse écrite. Elle intègre des outils d'analyse avancés pour générer des résumés, des conversions texte-audio et une interaction via un chatbot.

## Fonctionnalités principales :

- **Formats courts et simplifiés** : Obtenez des résumés clairs et précis en quelques secondes.
- **Formats diversifiés** : Transformez vos articles en texte ou en audio.
- **Playlists personnalisées** : Créez des collections audio de vos résumés préférés.
- **Chatbot interactif** : Posez des questions sur un article et recevez des réponses adaptées.

## Installation

Pour installer la bibliothèque, exécutez la commande suivante :

```python
pip install BmpLib-Ai
```

[GitHub Page](https://github.com/Taoufiq-Ouedraogo/Brief-My-Press-AI-Library)

[Pypi Page](https://pypi.org/project/BmpLib-Ai/)


[API Streamlit du Package Page](https://brief-my-press-ai.streamlit.app/Use_Python_API)



[Tuto on how to publish python package](https://packaging.python.org/en/latest/tutorials/packaging-projects/)

Pour chaque version:
- python3 -m build

- twine upload dist/*
- twine upload --skip-existing dist/*


## Exemple d’utilisation

```python
import BmpLib_Ai as bmp
```


### Résumés des articles

```python
# Contenu de l'article et ID du média
text = "L'intelligence artificielle transforme de nombreux secteurs en facilitant les processus analytiques."
media_id = "bmp_media1"

# Création de l'objet BMP
bmp_object = bmp.get_BMP_Article_Object(text, media_id)

# Obtenir les résumés
extractive_summary, abstractive_summary = bmp_object.get_summaries()

# Générer les audios
extractive_audio, abstractive_audio = bmp_object.get_audios()

# Poser une question sur l'article via le chatbot
response = bmp_object.chat_with_question("Quel est le sujet principal de cet article ?")
print("Réponse du chatbot :", response)
```

### Gestions des audios
```python
# Résultats
extractiveAudioBuffer, abstractiveAudioBuffer = bmp_object.get_audios()
        
# Enregistrement du buffer audio en MP3
with open("audio_extractif.mp3", "wb") as f:
    f.write(extractiveAudioBuffer.read())

with open("audio_abstractif.mp3", "wb") as f:
    f.write(abstractiveAudioBuffer.read())
```


### Interaction avec le Chatbot
```python
question = "De quoi parle cet article ?"
response = bmp_object.chat_with_question(question)
print("Réponse :", response)
```



___

### 🔹 Résumé Extractif        

- **Modèle** : `fr_core_news_sm` de [spaCy](https://spacy.io/models/fr#fr_core_news_sm).
- **Fonctionnement** : Le modèle analyse le texte et extrait les phrases les plus significatives.



### 🔹 Résumé Abstrait

- **Modèle** : `Falconsai/text_summarization` de [Hugging Face](https://huggingface.co/Falconsai/text_summarization).
- **Fonctionnement** : Génération d'un résumé condensé du texte en utilisant un modèle de résumé abstrait.


### 🔹 Audio 

- **Outil** : gTTS [Google Text-to-Speech](https://gtts.readthedocs.io/en/latest/).
- **Fonctionnement** : Convertit les résumés extraits et abstraits en fichiers audio pour une écoute rapide.
 



### 🔹 Chatbot            

- **Modèle** : `mlx-community/Llama-3.2-1B-Instruct-4bit` de [Hugging Face](https://huggingface.co/mlx-community/Llama-3.2-1B-Instruct-4bit).
- **Fonctionnement** : Permet d'interagir avec le contenu de l'article pour obtenir des réponses précises aux questions.



## Auteur

Taoufiq Ouedraogo
