File size: 3,911 Bytes
e3c83c3
 
 
 
 
 
 
 
 
 
 
d061b7b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
---

title: Arabic Story Content Moderator
emoji: ๐Ÿ“
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: 3.11.0
app_file: app.py
pinned: false
---


# Arabic Story Content Moderator

An AI-powered content moderation service for Arabic short stories that checks for cultural violations and inappropriate content using the Deepseek API.

## ๐ŸŒŸ Features

- **Cultural Sensitivity**: Checks stories against Arabic and Islamic cultural norms
- **Content Safety**: Detects inappropriate sexual content, excessive violence, and profanity
- **Real-time Moderation**: Fast API response for instant content validation
- **Batch Processing**: Support for moderating multiple stories at once
- **Arabic Language Support**: Specialized for Arabic text processing

## ๐Ÿš€ API Endpoints

### POST `/moderate`
Moderate a single Arabic story.

**Request:**
```json

{

    "story_content": "ู†ุต ุงู„ู‚ุตุฉ ุงู„ุนุฑุจูŠุฉ ู‡ู†ุง"

}

```

**Response:**
```json

{

    "approved": true,

    "response": "true",

    "timestamp": "2024-01-15T10:30:00"

}

```

### POST `/moderate/batch`
Moderate multiple stories at once.

**Request:**
```json

{

    "stories": ["ู‚ุตุฉ ุฃูˆู„ู‰", "ู‚ุตุฉ ุซุงู†ูŠุฉ", "ู‚ุตุฉ ุซุงู„ุซุฉ"]

}

```

### GET `/health`
Check service health status.

## ๐Ÿ“‹ Response Format

The API returns consistent responses:

- `approved`: Boolean indicating if content is approved
- `response`: String value "true" (approved) or "no" (rejected)
- `timestamp`: ISO timestamp of the moderation
- `reason`: Description if content is rejected

## ๐Ÿ”ง Moderation Criteria

### 1. Cultural and Religious Content
- No mockery of Islamic religion or Arabic traditions
- Respect for religious and social symbols
- Adherence to Islamic values

### 2. Sexual Content and Violence
- No explicit sexual content or suggestive material
- No excessive or graphic violence
- No profanity or inappropriate language

### 3. Sensitive Political Content
- No sectarian or ethnic incitement
- Avoidance of controversial political topics

### 4. Social Values
- Respect for family and community values
- No promotion of socially destructive behaviors

## ๐Ÿ› ๏ธ Integration Example

### cURL Example
```bash

curl -X POST "https://your-huggingface-space-url/moderate" \

  -H "Content-Type: application/json" \

  -d '{"story_content": "ู‚ุตุฉ ู‚ุตูŠุฑุฉ ุนู† ุงู„ุตุฏุงู‚ุฉ ูˆุงู„ูˆูุงุก"}'

```

### Python Example
```python

import requests



url = "https://your-huggingface-space-url/moderate"

data = {

    "story_content": "ู†ุต ุงู„ู‚ุตุฉ ุงู„ุนุฑุจูŠุฉ"

}



response = requests.post(url, json=data)

result = response.json()



if result["approved"]:

    print("Story approved for posting")

else:

    print("Story violates community guidelines")

```

## ๐Ÿ“ Setup Instructions

### Environment Variables
Set your Deepseek API key as an environment variable:
```

DEEPSEEK_API_KEY=your_deepseek_api_key_here

```

### Local Testing
```bash

pip install -r requirements.txt

export DEEPSEEK_API_KEY=your_api_key

python app.py

```

## ๐Ÿ”’ Privacy and Security

- Stories are processed in real-time and not stored
- API communications are encrypted
- No personal data is retained
- Compliant with data protection standards

## ๐Ÿ“ˆ Performance

- Average response time: < 2 seconds
- Supports concurrent requests
- Optimized for Arabic text processing
- Scalable architecture

## ๐Ÿค Integration with .NET Backend

This service is designed to integrate seamlessly with your .NET story posting API. When a user attempts to post a story, send it to this moderation service first.

## ๐Ÿ“ž Support

For technical support or questions about the moderation criteria, please refer to the documentation or contact the development team.

---

**Made with โค๏ธ for the Arabic literary community**