--- title: MaghrebInsights emoji: 📈 colorFrom: green colorTo: purple sdk: streamlit sdk_version: 1.35.0 app_file: app.py pinned: false --- # MaghrebInsights: Analyse de la Propagande AlgĂ©rienne This Streamlit application provides insights into Algerian propaganda by analyzing text data from Algerian news sources. It leverages the power of Google's Gemini large language model to generate insightful reports on potential propaganda techniques and their political implications. ## Features - **Data Analysis:** Extracts key information from Algerian news articles. - **Propaganda Detection:** Identifies and analyzes potential instances of propaganda techniques (e.g., disinformation, manipulation). - **Political Contextualization:** Provides insights into the political motivations and implications of the identified propaganda. - **Report Generation:** Generates comprehensive reports summarizing findings, analysis, and recommendations. - **User-Friendly Interface:** Easy-to-use Streamlit interface for seamless interaction. ## Getting Started ### Prerequisites - **Python 3.7+:** [https://www.python.org/downloads/](https://www.python.org/downloads/) - **Google Generative AI API Key:** Obtain an API key from [https://developers.google.com/generative-ai/docs/setup](https://developers.google.com/generative-ai/docs/setup) - **Data File (`data_tsa.json`):** Place your JSON data file containing Algerian news articles in the project root. ### Local Setup 1. **Clone the repository:** ```bash git clone https://github.com/your-username/your-repo-name.git cd your-repo-name ``` 2. **Create a Virtual Environment (Recommended):** ```bash python3 -m venv .venv source .venv/bin/activate ``` 3. **Install Dependencies:** ```bash pip install -r requirements.txt ``` 4. **Set Environment Variable:** ```bash export GENAI_API_KEY="your_actual_api_key" ``` (Replace "your_actual_api_key" with your Google Generative AI API key) 5. **Run the Streamlit App:** ```bash streamlit run app.py ``` ### Deployment on Hugging Face Spaces 1. **Create a Hugging Face Account:** [https://huggingface.co/](https://huggingface.co/) 2. **Create a New Space:** Click "New Space", choose "Streamlit" as the SDK, and provide a name for your Space. 3. **Upload Your Code:** - Upload the following files to your Hugging Face Space: - `app.py` (your main Streamlit application) - `requirements.txt` - `data_tsa.json` (your data file) 4. **Set Environment Variable (Secret):** - Go to your Space's settings -> "Secrets" -> "New secret": - **Name:** `GENAI_API_KEY` - **Secret value:** Paste your actual Google Generative AI API key. 5. **Hugging Face will automatically build and deploy your Streamlit app!** ## Usage 1. **Input Word:** Enter a keyword related to Morocco in the sidebar to analyze its presence and context in the data. 2. **Generate Report:** Click the "GĂ©nĂ©rer le Rapport Complet" button to trigger the analysis and report generation process. 3. **Review Insights:** Carefully examine the generated report, which provides: - A summary of the data. - A critical analysis of potential propaganda techniques. - Insights into the political context. - Recommendations based on the findings. ## Contributing Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions for improvement or would like to add new features. ## License This project is licensed under the [MIT License](LICENSE).