File size: 3,551 Bytes
0d5bf6d
 
 
 
 
 
 
 
 
 
 
2f38da0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
---
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).