RawiPostReview / README.md
walker11's picture
Upload README.md
e3c83c3 verified
---
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**