Spaces:
Sleeping
Sleeping
| 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** |